【发布时间】:2017-07-07 00:19:33
【问题描述】:
我已经使用 xampp 安装了 apache 2.4。我尝试使用提到的步骤添加 mod_wsgi here
但是当我添加行时
LoadModule wsgi_module modules/mod_wsgi-py34-vc10.so
Apache 没有启动。
【问题讨论】:
标签: django python-3.x xampp mod-wsgi apache2.4
我已经使用 xampp 安装了 apache 2.4。我尝试使用提到的步骤添加 mod_wsgi here
但是当我添加行时
LoadModule wsgi_module modules/mod_wsgi-py34-vc10.so
Apache 没有启动。
【问题讨论】:
标签: django python-3.x xampp mod-wsgi apache2.4
最好用代码自己构建 mod_wsgi,而不是使用网络上的任意二进制文件。步骤如下。
确保您有一个体面的 Apache 安装,其中包括头文件,例如Apache 2.4.37 Win64 from Apache Lounge 。最好安装在C:/Apache24的位置。
确保您的 Python 安装已设置好,以便您可以pip 安装模块。这必须包括具有该 Python 版本所需的正确 Microsoft C 编译器。
运行pip install mod_wsgi。如果您的 Apache 安装不在 C:/Apache24,则首先将环境变量 MOD_WSGI_APACHE_ROOTDIR 设置为其位置。确保将路径指定为 C:/Apache24 形式而不是反斜杠,也就是说,不是 C:\Apache24。这仅在安装时需要,以后不需要。
运行mod_wsgi-express module-config。
将运行 mod_wsgi-express module-config 的输出复制到您的 Apache 配置文件中。
将 WSGI 应用程序的配置添加到 Apache 配置中。
重启 Apache 看看它是否工作。
请注意,在最初测试时,最好从 WSGI hello world 开始,而不是使用一些庞大的 Django 应用程序。
【讨论】:
pip install mod_wsgi 时,它会失败并显示c:\apache24\include\apr_network_io.h(29) : fatal error C1083: Cannot open include file: 'apr_perms_set.h': No such file or directory'. 这是httpd 2.4.27。任何想法如何解决这个问题?
http://mirrors.gigenet.com/apache/httpd/httpd-2.4.27.tar.gz下载的源代码。我刚刚尝试使用从 github 克隆的源代码进行构建,但使用 c:\apache24\include\ap_hooks.h(39) : fatal error C1083: Cannot open include file: 'apr.h': No such file or directory 失败了
set MOD_WSGI_APACHE_ROOTDIR=c:/path/to/apache完成的,注意一旦你关闭cms就会取消设置
This topic is useful for Windows 10, xampp webserver as well.
I was struggling to find precompiled mod_wsgi.so for
Apache/2.4.27 (Win32)
Python/2.7.13
This [link][1] is useful to find the appropriate version of mod_wsgi.
IF you are lucky, you can find the precompiled version [here][2]
There is a step by step guidance available [here][3]
[1]: https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst
[2]: http://www.lfd.uci.edu/~gohlke/pythonlibs/#mod_wsgi
[3]: https://everything2.com/title/Installing+Python+on+XAMPP
【讨论】:
pip install mod_wsgi 自己构建它,如另一个答案中所述。不能保证抓取任意二进制文件有效。您应该为您的特定 Apache 安装构建它。
pip install <.whl file>,然后继续按照这里的说明进行操作:github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/…
@LarryMartell
我在 Windows 上遇到了同样的问题并修复了它。
您可以尝试将文件 apr_perms_set.h 从 apr 存储库 (https://github.com/traviscross/apr) 复制到 Apache2.4 的包含文件夹。
【讨论】:
如果您仍然找到c:\apache24\include\apr_network_io.h(29) : fatal error C1083: Cannot open include file: 'apr_perms_set.h': No such file or directory'. ,请使用 Apache Lounge 的发行版。
这最适合 Windows。
【讨论】:
我使用的是 64 位操作系统并安装了 64 位 python。
从 apachelounge https://www.apachelounge.com/download/ 为 64 位操作系统安装 apache 分发解决了我的问题。
【讨论】: