在Apache上托管Django应用程序

时间:2020-04-04 17:25:25

标签: python django apache

我正在跟踪有关在Apache上托管Django应用程序的教程,并且对这些服务器错误类型还是陌生的。

我使用以下代码修改了apache配置文件以与我的应用程序的wsgi通信:

LoadModule wsgi_module "c:/users/adwy/appdata/local/programs/python/python35/lib/site-packages/mod_wsgi/server/mod_wsgi.cp35-win_amd64.pyd"
WSGIScriptAlias / "D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py"
WSGIPythonHome "C:/Users/Adwy/AppData/Local/Programs/Python/Python35"
WSGIPythonPath "D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app"

Alias /static/ C:/Users/Adwy/Adwy/Django_ Learning_ 1/Lib/site-packages/django/contrib/admin\static

Alias /templates/ C:/Users/Adwy/Adwy/Django_ Learning_ 1/Lib/site-packages/django/contrib/admin/templates

<Directory C:/Users/Adwy/Adwy/Django_ Learning_ 1/Lib/site-packages/django/contrib/admin/static>
    Require all granted
</Directory>

<Directory C:/Users/Adwy/Adwy/Django_ Learning_ 1/Lib/site-packages/django/contrib/admin/templates>
    Require all granted
</Directory>

<Directory "D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app">
   <Files wsgi.py>
      Require all granted
   </Files>
</Directory>

-现在,我重新启动了apache服务器,并并行运行Django服务器,出现错误500,

在这里,我从Apache服务器复制以下错误日志:

[Sat Apr 04 18:41:05.681919 2020] [wsgi:warn] [pid 8608:tid 288] (70008)Partial results are valid but processing is incomplete: mod_wsgi (pid=8608): Unable to stat Python home C:/Users/Adwy/AppData/Local/Programs/Python/Python35. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path.
 [Sat Apr 04 18:41:05.725921 2020] [mpm_winnt:notice] [pid 8608:tid 288] AH00354: Child: Starting 150 worker threads.
[Sat Apr 04 18:41:05.780924 2020] [wsgi:error] [pid 8608:tid 1780] [client 192.168.2.130:49438] mod_wsgi (pid=8608): Failed to exec Python script file 'D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py'.
[Sat Apr 04 18:41:05.780924 2020] [wsgi:error] [pid 8608:tid 1780] [client 192.168.2.130:49438] mod_wsgi (pid=8608): Exception occurred processing WSGI script 'D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py'.
[Sat Apr 04 18:41:05.780924 2020] [wsgi:error] [pid 8608:tid 1780] [client 192.168.2.130:49438] Traceback (most recent call last):\r
[Sat Apr 04 18:41:05.780924 2020] [wsgi:error] [pid 8608:tid 1780] [client 192.168.2.130:49438]   File "D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py", line 12, in <module>\r
[Sat Apr 04 18:41:05.780924 2020] [wsgi:error] [pid 8608:tid 1780] [client 192.168.2.130:49438]     from django.core.wsgi import get_wsgi_application\r
[Sat Apr 04 18:41:05.780924 2020] [wsgi:error] [pid 8608:tid 1780] [client 192.168.2.130:49438] ImportError: No module named 'django'\r
[Sat Apr 04 18:41:05.781924 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49439] mod_wsgi (pid=8608): Failed to exec Python script file 'D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py'.
[Sat Apr 04 18:41:05.781924 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49439] mod_wsgi (pid=8608): Exception occurred processing WSGI script 'D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py'.
[Sat Apr 04 18:41:05.781924 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49439] Traceback (most recent call last):\r
[Sat Apr 04 18:41:05.781924 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49439]   File "D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py", line 12, in <module>\r
[Sat Apr 04 18:41:05.781924 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49439]     from django.core.wsgi import get_wsgi_application\r
[Sat Apr 04 18:41:05.781924 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49439] ImportError: No module named 'django'\r
[Sat Apr 04 18:41:05.818927 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49441] mod_wsgi (pid=8608): Failed to exec Python script file 'D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py'., referer: http://192.168.2.130/
[Sat Apr 04 18:41:05.818927 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49441] mod_wsgi (pid=8608): Exception occurred processing WSGI script 'D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py'., referer: http://192.168.2.130/
[Sat Apr 04 18:41:05.818927 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49441] Traceback (most recent call last):\r, referer: http://192.168.2.130/
[Sat Apr 04 18:41:05.818927 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49441]   File "D:/Backup/Learning Python/Organized and important file/Learning files and sheets/Django_ Learning_ 1/weblog_app/weblog_app/wsgi.py", line 12, in <module>\r, referer: http://192.168.2.130/
[Sat Apr 04 18:41:05.818927 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49441]     from django.core.wsgi import get_wsgi_application\r, referer: http://192.168.2.130/
[Sat Apr 04 18:41:05.818927 2020] [wsgi:error] [pid 8608:tid 1772] [client 192.168.2.130:49441] ImportError: No module named 'django'\r, referer: http://192.168.2.130/

服务器错误的主要消息是:

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

我希望我可以运行该服务器,

,谢谢,

0 个答案:

没有答案