在Apache上托管Django应用程序

2024-04-30 03:53:18 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在学习一个关于在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.

我希望我能让这台服务器运行

谢谢,


Tags: anddjangoclientappwsgierrorpidsat