wsgi.py'无法作为Python模块加载--Python3

时间:2018-01-16 19:16:11

标签: python django apache2 wsgi

我正在使用python3来构建应用程序

[Tue Jan 16 19:07:13.587669 2018] [wsgi:error] [pid 22631:tid 140432910448384] [remote 172.19.217.162:48145] mod_wsgi (pid=22631): Target WSGI script '/u0/shsathya/html/captool/captool/wsgi.py' cannot be loaded as Python module.
[Tue Jan 16 19:07:13.587752 2018] [wsgi:error] [pid 22631:tid 140432910448384] [remote 172.19.217.162:48145] mod_wsgi (pid=22631): Exception occurred processing WSGI script '/u0/shsathya/html/captool/captool/wsgi.py'.
[Tue Jan 16 19:07:13.587979 2018] [wsgi:error] [pid 22631:tid 140432910448384] [remote 172.19.217.162:48145] Traceback (most recent call last):
[Tue Jan 16 19:07:13.588026 2018] [wsgi:error] [pid 22631:tid 140432910448384] [remote 172.19.217.162:48145]   File "/u0/shsathya/html/captool/captool/wsgi.py", line 14, in <module>
[Tue Jan 16 19:07:13.588036 2018] [wsgi:error] [pid 22631:tid 140432910448384] [remote 172.19.217.162:48145]     from django.core.wsgi import get_wsgi_application
[Tue Jan 16 19:07:13.588059 2018] [wsgi:error] [pid 22631:tid 140432910448384] [remote 172.19.217.162:48145] ImportError: No module named 'django.core'

1 个答案:

答案 0 :(得分:0)

请确保django处于PYTHONPATH状态。 从python shell测试导入django

Python 3.6.1 (default, Dec 2015, 13:05:11)
[GCC 4.8.2] on linux
>>>import django
>>>

您需要设置已根据您使用的python 3版本编译的mod_wsgi。 请参考这里验证你的mod_wsgi编译为什么版本的python-&gt; http://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html