gpt4 book ai didi

Windows 上的 Python-Django-WSGI-Apache - “ImportError: No module named site”

转载 作者:太空宇宙 更新时间:2023-11-03 15:57:33 26 4
gpt4 key购买 nike

我正在尝试使用 wsgi mod 将 django 与 Windows 服务器上的 apache 连接。当我运行 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的路径。

关于Windows 上的 Python-Django-WSGI-Apache - “ImportError: No module named site”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40650307/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com