【问题标题】:Python-Django-WSGI-Apache on windows - “ImportError: No module named site”Windows 上的 Python-Django-WSGI-Apache - “ImportError: No module named site”
【发布时间】:2017-03-31 17:22:54
【问题描述】:

我正在尝试使用 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

【问题讨论】:

    标签: python django windows apache mod-wsgi


    【解决方案1】:

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

    WSGIPythonHome C:/Python27
    

    这表示python的路径。

    【讨论】:

      猜你喜欢
      • 2016-12-23
      • 2016-12-19
      • 1970-01-01
      • 1970-01-01
      • 2013-06-27
      • 2015-05-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多