当没有端口号的Django应用部署时,如何解决错误目标脚本无法作为python模块加载的问题

时间:2019-05-05 16:26:27

标签: python django apache ubuntu

当我使用ubuntu 16.04服务器在AWS EC2实例上部署django应用程序时,它给出了一个错误:

[Sun May 05 16:13:25.466264 2019] [wsgi:error] [pid 5649:tid 140262036731648] [remote 157.50.50.61:56646] mod_wsgi (pid=5649): Target WSGI script '/var/www/html/simple_django_project/django_project/django_project/wsgi.py' cannot be loaded as Python module.
[Sun May 05 16:13:25.466312 2019] [wsgi:error] [pid 5649:tid 140262036731648] [remote 157.50.50.61:56646] mod_wsgi (pid=5649): Exception occurred processing WSGI script '/var/www/html/simple_django_project/django_project/django_project/wsgi.py'.
[Sun May 05 16:13:25.466388 2019] [wsgi:error] [pid 5649:tid 140262036731648] [remote 157.50.50.61:56646] Traceback (most recent call last):
[Sun May 05 16:13:25.466409 2019] [wsgi:error] [pid 5649:tid 140262036731648] [remote 157.50.50.61:56646]   File "/var/www/html/simple_django_project/django_project/django_project/wsgi.py", line 12, in <module>
[Sun May 05 16:13:25.466413 2019] [wsgi:error] [pid 5649:tid 140262036731648] [remote 157.50.50.61:56646]     from django.core.wsgi import get_wsgi_application
[Sun May 05 16:13:25.466429 2019] [wsgi:error] [pid 5649:tid 140262036731648] [remote 157.50.50.61:56646] ImportError: No module named 'django'

000-default.conf

<VirtualHost *:80>
   ServerName pythontestdjangoapp.tk
   ServerAlias www.pythontestdjangoapp.tk

    DocumentRoot /var/www/html/simple_django_project

    ErrorLog/var/www/html/simple_django_project/django_project/logs/error.log
    CustomLog 
     /var/www/html/simple_django_project/django_project/logs/debug.log 
    combined


   <Directory />
     #Options FollowSymLinks
     Options Indexes FollowSymLinks Includes ExecCGI
     AllowOverride All
     Require all granted
   </Directory>

   <Directory 
     /var/www/html/simple_django_project/django_project/django_project/>
        <Files wsgi.py>
            AllowOverride All
            Require all granted
        </Files>
   </Directory>
   WSGIDaemonProcess django_project python- 
   path=/var/www/html/simple_djnago_project/django_project python- 
   home=/var/www/html/simple_django_project/myvenv
   WSGIProcessGroup django_project


   WSGIScriptAlias / 
   /var/www/html/simple_django_project/django_project/django_project/wsgi.py
</VirtualHost>

当我启动apache服务器时,它给了我一个内部服务器错误

0 个答案:

没有答案