[wsgi:error]:没有名为mysite.settings的模块

我在Wamp服务器上部署了Django应用程序,它工作正常。[wsgi:error]:没有名为mysite.settings的模块

WSGIScriptAlias/"D:/testdeployment/mysite/mysite/wsgi.py" 

WSGIPythonPath "D:/testdeployment/mysite/mysite/"

<Directory "D:/testdeployment/mysite/mysite/">

Order deny,allow

Allow from all

Require all granted

</Directory>

<Directory "D:/testdeployment/mysite/mysite/">

<Files wsgi.py>

Require all granted

</Files>

SSLOptions +StdEnvVars

Options Indexes FollowSymLinks MultiViews

AllowOverride All

Require local

</Directory>

请让我知道了什么是问题:不幸的是运行PIP安装WAMP的服务器停止服务的Django应用程序了,丢以下错误

mod_wsgi (pid=26240): Target WSGI script 'D:/testdeployment/mysite/mysite/wsgi.py' cannot be loaded as Python module. 

mod_wsgi (pid=26240): Exception occurred processing WSGI script 'D:/testdeployment/mysite/mysite/wsgi.py'.

Traceback (most recent call last):

File "D:/testdeployment/mysite/mysite/wsgi.py", line 16, in <module>

application = get_wsgi_application()

File "C:\\Python27\\lib\\site-packages\\django-1.9.4-py2.7.egg\\django\\core\\wsgi.py", line 13, in get_wsgi_application

django.setup()

File "C:\\Python27\\lib\\site-packages\\django-1.9.4-py2.7.egg\\django\\__init__.py", line 17, in setup

configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)

File "C:\\Python27\\lib\\site-packages\\django-1.9.4-py2.7.egg\\django\\conf\\__init__.py", line 55, in __getattr__

self._setup(name)

File "C:\\Python27\\lib\\site-packages\\django-1.9.4-py2.7.egg\\django\\conf\\__init__.py", line 43, in _setup

self._wrapped = Settings(settings_module)

File "C:\\Python27\\lib\\site-packages\\django-1.9.4-py2.7.egg\\django\\conf\\__init__.py", line 99, in __init__

mod = importlib.import_module(self.SETTINGS_MODULE)

File "C:\\Python27\\Lib\\importlib\\__init__.py", line 37, in import_module

__import__(name)

ImportError: No module named mysite.settings

WSGI.PY

import os 

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")

application = get_wsgi_application()

WAMP配置后这里

回答:

python路径应该是外部的mysite目录(包含manage.py的目录),而不是内部mysite目录(包含settings.pywsgi.py的目录)。

WSGIPythonPath "D:/testdeployment/mysite/" 

见deploying with Apache and mod_wsgi Django文档获取更多信息。

以上是 [wsgi:error]:没有名为mysite.settings的模块 的全部内容, 来源链接: utcz.com/qa/263083.html

回到顶部