这是我的django.wsgi文件:
import os
import sys
path1 = '/srv/site/app'
path2 = '/srv/site'
if path1 not in sys.path:
sys.path.insert(0,path1)
if path2 not in sys.path:
sys.path.insert(1,path2)
os.environ['DJANGO_SETTINGS_MODULE'] = 'app.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
ImportError: Could not import settings 'app.settings' (Is it on sys.path?): No module named app.settings
Apache没有找到设置文件。 我不知道什么时候出错了。
答案 0 :(得分:1)
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_name.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()