我的django项目有这种树
项目树
project/
apache/
apache_django_wsgi.conf
project.wsgi
...
module1/
module2/
settings.py
settings_production.py
...
project.wsgi
import os, sys
apache_configuration = os.path.dirname(__file__)
project = os.path.dirname(apache_configuration)
workspace = os.path.dirname(project)
sys.path.append(workspace)
os.environ['DJANGO_SETTINGS_MODULE'] = 'project.settings_production'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
我遇到了这种错误(从模板上调试过):
没有名为module1的模块
我做错了什么?
答案 0 :(得分:1)
另外添加:
sys.path.append(project)