我在 webfaction 服务器下部署了我的 django 项目,名为“Hesperides”。webfaction 中的默认项目文件夹是“myproject”,所以我遇到了这个错误:
ImportError: Could not import settings 'myproject.settings' (Is it on sys.path?): No module named myproject.settings
问题是:我怎样才能从 Hesperides.settings 而不是从 myproject.settings 导入设置?谢谢你的时间。
我的 httpd.conf:
WSGIDaemonProcess jinn processes=2 threads=12 python-path=/home/zeioth/webapps/jinn:/home/zeioth/webapps/jinn/myproject:/home/zeioth/webapps/jinn/lib/python2.7:
WSGIScriptAlias / /home/zeioth/webapps/jinn/myproject/Hesperides/wsgi.py
我的wsgi.py
import os
import sys
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'Hesperides.settings'
application = WSGIHandler()
我的文件夹树:
jinn
--apache2
-bin
--conf
-httpd.conf
-mime.types
-lib
-logs
-modules
-bin
-lib
--myproject
-manage.py
--Hesperides
-wsgi.py
-urls.py
-__init__.py
-settings.py
-apps