我正在尝试在Ubuntu服务器上部署我的应用程序,据我所知,一切都已正确完成,但是我总是收到500个内部服务器发布错误。
我已经尝试了许多故障排除指南,但是找不到有用的解决方案。 这是/ etc / apache2 / sites-avail conf文件
Alias /static /home/local/user/wesupportapp/static
<Directory /home/local/user/wesupportapp/static>
Require all granted
</Directory>
Alias /media /home/local/user/wesupportapp/media
<Directory /home/local/user/wesupportapp/media>
Require all granted
</Directory>
<Directory /home/local/user/wesupportapp/wesupportapp>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/local/user/wesupportapp/wesupportapp/wsgi.py
WSGIDaemonProcess django_app python-path=/home/local/user/wesupportapp python-home=/home/local/user/wesupportapp/venv
WSGIProcessGroup django_app
当我在django的开发服务器上运行该应用程序时,一切正常,但是一旦启用了应用程序配置文件,我将出现500错误。
如果有人遇到我同样遇到的问题,确实可以帮助我解决这个问题,将不胜感激。
apache2错误日志
[Tue Jul 16 10:42:33.386640 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.72.15.5:3756] File "/home/local/user/wesupportapp/wesupportapp/wsgi.py", line 12, in <module>
[Tue Jul 16 10:42:33.386644 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.72.15.5:3756] from django.core.wsgi import get_wsgi_application
[Tue Jul 16 10:42:33.386692 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.72.15.5:3756] ImportError: No module named 'django'
[Tue Jul 16 10:47:48.994459 2019] [wsgi:error] [pid 6299:tid 139834212525824] [remote 10.216.63.3:3756] mod_wsgi (pid=6299): Target WSGI script '/home/local/user/wesupportapp/wesupportapp/wsgi.py' cannot be loaded as P$
[Tue Jul 16 10:47:48.994552 2019] [wsgi:error] [pid 6299:tid 139834212525824] [remote 10.216.63.3:3756] mod_wsgi (pid=6299): Exception occurred processing WSGI script '/home/local/user/wesupportapp/wesupportapp/wsgi.py$
[Tue Jul 16 10:47:48.994706 2019] [wsgi:error] [pid 6299:tid 139834212525824] [remote 10.216.63.3:3756] Traceback (most recent call last):
[Tue Jul 16 10:47:48.994734 2019] [wsgi:error] [pid 6299:tid 139834212525824] [remote 10.216.63.3:3756] File "/home/local/user/wesupportapp/wesupportapp/wsgi.py", line 12, in <module>
[Tue Jul 16 10:47:48.994739 2019] [wsgi:error] [pid 6299:tid 139834212525824] [remote 10.216.63.3:3756] from django.core.wsgi import get_wsgi_application
[Tue Jul 16 10:47:48.994764 2019] [wsgi:error] [pid 6299:tid 139834212525824] [remote 10.216.63.3:3756] ImportError: No module named 'django'
[Tue Jul 16 11:03:42.242236 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.216.63.3:684] mod_wsgi (pid=6299): Target WSGI script '/home/local/user/wesupportapp/wesupportapp/wsgi.py' cannot be loaded as Py$
[Tue Jul 16 11:03:42.242345 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.216.63.3:684] mod_wsgi (pid=6299): Exception occurred processing WSGI script '/home/local/user/wesupportapp/wesupportapp/wsgi.py'.
[Tue Jul 16 11:03:42.242464 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.216.63.3:684] Traceback (most recent call last):
[Tue Jul 16 11:03:42.242485 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.216.63.3:684] File "/home/local/user/wesupportapp/wesupportapp/wsgi.py", line 12, in <module>
[Tue Jul 16 11:03:42.242489 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.216.63.3:684] from django.core.wsgi import get_wsgi_application
[Tue Jul 16 11:03:42.242509 2019] [wsgi:error] [pid 6299:tid 139834262898432] [remote 10.216.63.3:684] ImportError: No module named 'django'
答案 0 :(得分:2)
就我而言,我忘记在虚拟环境中安装Django。在此虚拟环境中安装Django
/home/local/user/wesupportapp/venv