按照参考文章配置myweb/wsgi.py文件时:
……
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application() 一直报错“ImportError: Could not import settings 'myweb.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named myweb.settings”,google了一下众说纷纭,最后修改如下才正常:
import os,sys
#os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myweb.settings")
path = 'D:\www'
if path not in sys.path:
sys.path.insert(0, 'D:\www')
os.environ["DJANGO_SETTINGS_MODULE"] = "myweb.settings"
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()