500 内部服务器错误 django + mod_wsgi + ubuntu 16 上的 apache2

500 Internal Server Error django + mod_wsgi + apache2 on ubuntu 16

我正在尝试将我的应用程序部署到 Ubuntu 服务器上,据我所知,我所做的一切都是正确的,但我总是收到 500 内部服务器问题错误。

我尝试了很多故障排除指南,但我找不到任何有用的方法来解决问题。 这是 /etc/apache2/sites-available 配置文件

        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'

就我而言,我忘记在虚拟环境中安装Django。在此虚拟环境中安装 Django

/home/local/user/wesupportapp/venv