python-django 部署

trouble shooting:

1.ImportError: Could not import settings ‘mysite.settings’ when deploying django? just add the following to the file:
import sys
sys.path = [‘/home/mysite/prg/mysite/mysite_django’, ‘/home/mysite/prg/mysite’] + sys.path


2. you can confirm the problem by:
>>>import sys
>>>print sys.path
# you will find there is no directory of your django root. that's the problem
>>> sys.path = ['/home/mysite/prg/mysite/mysite_django', '/home/mysite/prg/mysite'] + sys.path
>>>import mysite_django.settings
# this should be no errors 
3. a config file of apache should like this:
    WSGIDaemonProcess python-path=/usr/lib/python2.7/site-packages:/var/www/html/mysite/django
    WSGIScriptAlias / /var/www/html/mysite/django/mysite/
    DocumentRoot /var/www/html/mysite/django
    ErrorLog /var/log/httpd/
    CustomLog /var/log/httpd/ combined
    <Directory /var/www/html/mysite/django>
        Order allow,deny
        Allow from all

reference from :


电子邮件地址不会被公开。 必填项已用 * 标注