使用mod_wsgi在httpd上运行Django应用时出错

时间:2019-04-09 16:28:58

标签: python django apache

错误日志:

[client 10.10.10.220] mod_wsgi (pid=11514): Target WSGI script '/opt/<project-name>/<app-name>/wsgi.py' cannot be loaded as Python module.
[Tue Apr 09 11:06:39 2019] [error] [client 10.10.10.220] mod_wsgi (pid=11514): Exception occurred processing WSGI script '/opt/<project-name>/<app-name>/wsgi.py'.
[Tue Apr 09 11:06:39 2019] [error] Traceback (most recent call last):
[Tue Apr 09 11:06:39 2019] [error]   File "/opt/<project-name>/<app-name>/wsgi.py", line 10, in <module>
[Tue Apr 09 11:06:39 2019] [error]     import os
[Tue Apr 09 11:06:39 2019] [error] ImportError: No module named os

httpd.conf:

WSGIScriptAlias / /opt/<project>/<app>/wsgi.py
WSGIPythonHome /opt/<project>/venv
WSGIPythonPath /opt/<project>
<Directory /opt/<project>/<app>
    <Files wsgi.py>
       Allow from all
    </Files>
</Directory>

已使用:

  • 带有virtualenv的Python 3.6
  • Django 2.1

0 个答案:

没有答案