Python-Django-WSGI-Apache on windows - “ImportError: No modu



我正在尝试连接django与apache在windows服务器与wsgi mod。当我运行httpd.exe时,它立即关闭。在error.log中我得到了这个:

[Thu Nov 17 00:44:19.918823 2016] [wsgi:warn] [pid 520:tid 452] mod_wsgi: Compiled for Python/2.7.9+.
[Thu Nov 17 00:44:19.918823 2016] [wsgi:warn] [pid 520:tid 452] mod_wsgi: Runtime using Python/2.7.11.
[Thu Nov 17 00:44:19.918823 2016] [mpm_winnt:notice] [pid 520:tid 452] AH00455: Apache/2.4.23 (Win64) mod_wsgi/4.4.12 Python/2.7.11 configured -- resuming normal operations
[Thu Nov 17 00:44:19.918823 2016] [mpm_winnt:notice] [pid 520:tid 452] AH00456: Apache Lounge VC10 Server built: Jul  9 2016 11:59:00
[Thu Nov 17 00:44:19.918823 2016] [core:notice] [pid 520:tid 452] AH00094: Command line: 'httpd -d C:/Apache24'
[Thu Nov 17 00:44:19.918823 2016] [core:debug] [pid 520:tid 452] log.c(1543): AH02639: Using SO_REUSEPORT: no (0)
[Thu Nov 17 00:44:19.918823 2016] [mpm_winnt:notice] [pid 520:tid 452] AH00418: Parent: Created child process 2308
[Thu Nov 17 00:44:19.918823 2016] [mpm_winnt:debug] [pid 520:tid 452] mpm_winnt.c(429): AH00402: Parent: Sent the scoreboard to the child
[Thu Nov 17 00:44:20.043916 2016] [wsgi:warn] [pid 2308:tid 448] mod_wsgi: Compiled for Python/2.7.9+.
[Thu Nov 17 00:44:20.043916 2016] [wsgi:warn] [pid 2308:tid 448] mod_wsgi: Runtime using Python/2.7.11.
[Thu Nov 17 00:44:20.043916 2016] [mpm_winnt:debug] [pid 2308:tid 448] mpm_winnt.c(1718): AH00453: Child process is running
[Thu Nov 17 00:44:20.043916 2016] [wsgi:info] [pid 2308:tid 448] mod_wsgi (pid=2308): Initializing Python.
ImportError: No module named site
[Thu Nov 17 00:44:20.059467 2016] [mpm_winnt:crit] [pid 520:tid 452] AH00419: master_main: create child process failed. Exiting.
[Thu Nov 17 00:44:20.059467 2016] [core:info] [pid 520:tid 452] AH00096: removed PID file C:/Apache24/logs/httpd.pid (pid=520)
我的python版本是2.7.11我的apache版本是2.4.23

我找到了问题的答案:apache服务器运行python,但不是正确的。我必须在httpd.conf文件中指定python的路径,如下所示:

WSGIPythonHome C:/Python27

表示python的路径