无法让我的Apache使用mod_wsgi

时间:2016-10-10 07:59:02

标签: python apache mod-wsgi

根据指南,我下载了mod_wsgi-win32-ap22py27-3.3.so,将其重命名为mod_wsgi.so并将其放入Apache的/ modules文件夹中。

接下来我添加了' LoadModule wsgi_module modules / mod_wsgi.so'一行到httpd.conf。

启动Apache时,它向我提出了这个错误:"请求的操作失败了!"

这是error.log的输出:

Starting the Apache2.2 service
The Apache2.2 service is running.
] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 12:59:37 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 12:59:37 2016] [notice] Parent: Created child process 3420
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Child process is running
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Acquired the start mutex.
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Starting 64 worker threads.
[Fri Oct 07 12:59:38 2016] [notice] Child 3420: Starting thread to listen on port 80.
[Fri Oct 07 12:59:58 2016] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
[Fri Oct 07 12:59:59 2016] [error] [client 127.0.0.1] File does not exist: C:/Program Files (x86)/Apache Software Foundation/Apache2.2/htdocs/favicon.ico
[Fri Oct 07 13:01:05 2016] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Oct 07 13:01:05 2016] [notice] Child 3420: Exit event signaled. Child process is ending.
[Fri Oct 07 13:01:06 2016] [notice] Child 3420: Released the start mutex
[Fri Oct 07 13:01:07 2016] [notice] Child 3420: All worker threads have exited.
[Fri Oct 07 13:01:07 2016] [notice] Child 3420: Child process is exiting
[Fri Oct 07 13:01:07 2016] [notice] Parent: Child process exited successfully.
[Fri Oct 07 13:07:27 2016] [warn] mod_wsgi: Compiled for Python/2.7.
[Fri Oct 07 13:07:27 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:07:27 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/3.3 Python/2.7.11 configured -- resuming normal operations
[Fri Oct 07 13:07:27 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:07:27 2016] [notice] Parent: Created child process 7712
[Fri Oct 07 13:07:28 2016] [warn] mod_wsgi: Compiled for Python/2.7.
[Fri Oct 07 13:07:28 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:07:28 2016] [notice] Child 7712: Child process is running
ImportError: No module named site
[Fri Oct 07 13:07:28 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 13:42:17 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 13:42:17 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:42:17 2016] [notice] Parent: Created child process 5752
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Child process is running
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Acquired the start mutex.
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Starting 64 worker threads.
[Fri Oct 07 13:42:17 2016] [notice] Child 5752: Starting thread to listen on port 80.
[Fri Oct 07 13:42:28 2016] [notice] Parent: Received restart signal -- Restarting the server.
[Fri Oct 07 13:42:28 2016] [notice] Child 5752: Exit event signaled. Child process is ending.
[Fri Oct 07 13:42:28 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 13:42:28 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:42:28 2016] [notice] Parent: Created child process 5828
[Fri Oct 07 13:42:28 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 13:42:28 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:42:28 2016] [notice] Child 5828: Child process is running
ImportError: No module named site
[Fri Oct 07 13:42:28 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 13:42:29 2016] [notice] Child 5752: Released the start mutex
[Fri Oct 07 13:42:30 2016] [notice] Child 5752: All worker threads have exited.
[Fri Oct 07 13:42:30 2016] [notice] Child 5752: Child process is exiting
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:43:17 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/4.4.12 Python/2.7.11 configured -- resuming normal operations
[Fri Oct 07 13:43:17 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 13:43:17 2016] [notice] Parent: Created child process 1200
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 13:43:17 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 13:43:17 2016] [notice] Child 1200: Child process is running
ImportError: No module named site
[Fri Oct 07 13:43:17 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 14:01:14 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/4.4.12 Python/2.7.11 configured -- resuming normal operations
[Fri Oct 07 14:01:14 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 14:01:14 2016] [notice] Parent: Created child process 6128
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Fri Oct 07 14:01:14 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Fri Oct 07 14:01:14 2016] [notice] Child 6128: Child process is running
ImportError: No module named site
[Fri Oct 07 14:01:14 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Fri Oct 07 14:01:24 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Fri Oct 07 14:01:24 2016] [notice] Server built: Jul 10 2013 01:52:12
[Fri Oct 07 14:01:24 2016] [notice] Parent: Created child process 8268
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Child process is running
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Acquired the start mutex.
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Starting 64 worker threads.
[Fri Oct 07 14:01:24 2016] [notice] Child 8268: Starting thread to listen on port 80.
[Fri Oct 07 14:01:29 2016] [notice] Parent: Received shutdown signal -- Shutting down the server.
[Fri Oct 07 14:01:29 2016] [notice] Child 8268: Exit event signaled. Child process is ending.
[Fri Oct 07 14:01:30 2016] [notice] Child 8268: Released the start mutex
[Fri Oct 07 14:01:31 2016] [notice] Child 8268: All worker threads have exited.
[Fri Oct 07 14:01:31 2016] [notice] Child 8268: Child process is exiting
[Fri Oct 07 14:01:31 2016] [notice] Parent: Child process exited successfully.
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Mon Oct 10 09:37:29 2016] [notice] Apache/2.2.25 (Win32) mod_wsgi/4.4.12 Python/2.7.11 configured -- resuming normal operations
[Mon Oct 10 09:37:29 2016] [notice] Server built: Jul 10 2013 01:52:12
[Mon Oct 10 09:37:29 2016] [notice] Parent: Created child process 1012
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Mon Oct 10 09:37:29 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Mon Oct 10 09:37:29 2016] [notice] Child 1012: Child process is running
ImportError: No module named site
[Mon Oct 10 09:37:29 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Mon Oct 10 09:37:55 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Mon Oct 10 09:37:55 2016] [notice] Server built: Jul 10 2013 01:52:12
[Mon Oct 10 09:37:55 2016] [notice] Parent: Created child process 6368
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Child process is running
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Acquired the start mutex.
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Starting 64 worker threads.
[Mon Oct 10 09:37:55 2016] [notice] Child 6368: Starting thread to listen on port 80.
[Mon Oct 10 09:38:14 2016] [notice] Parent: Received restart signal -- Restarting the server.
[Mon Oct 10 09:38:14 2016] [notice] Child 6368: Exit event signaled. Child process is ending.
[Mon Oct 10 09:38:15 2016] [notice] Apache/2.2.25 (Win32) configured -- resuming normal operations
[Mon Oct 10 09:38:15 2016] [notice] Server built: Jul 10 2013 01:52:12
[Mon Oct 10 09:38:15 2016] [notice] Parent: Created child process 7484
[Mon Oct 10 09:38:15 2016] [warn] mod_wsgi: Compiled for Python/2.7.9+.
[Mon Oct 10 09:38:15 2016] [warn] mod_wsgi: Runtime using Python/2.7.11.
[Mon Oct 10 09:38:15 2016] [notice] Child 7484: Child process is running
ImportError: No module named site
[Mon Oct 10 09:38:15 2016] [crit] (OS 1813)Der angegebene Ressourcentyp wurde nicht in der Image-Datei gefunden.  : master_main: create child process failed. Exiting.
[Mon Oct 10 09:38:15 2016] [warn] (OS 995)Der E/A-Vorgang wurde wegen eines Threadendes oder einer Anwendungsanforderung abgebrochen.  : winnt_accept: Asynchronous AcceptEx failed.
[Mon Oct 10 09:38:15 2016] [notice] Child 6368: Released the start mutex
[Mon Oct 10 09:38:16 2016] [notice] Child 6368: All worker threads have exited.
[Mon Oct 10 09:38:16 2016] [notice] Child 6368: Child process is exiting

我不确定问题究竟是什么问题,因为mod_wsg适用于Python 2.7,我使用的是Python 2.7(32位)以及Apache 2.2(32位)。

1 个答案:

答案 0 :(得分:1)

解决了这个问题。

我必须设置环境变量PYTHONHOME和PYTHONPATH来修复' ImportError:No module named site'错误。

set PYTHONHOME=c:\Python27
set PYTHONPATH=c:\Python27\Lib
set PATH=%PYTHONHOME%;%PATH%