如何在Windows上为apache 2.4和python 3.4安装mod_wsgi?

时间:2017-02-17 12:53:39

标签: django python-3.x xampp mod-wsgi apache2.4

我已经使用xampp安装了apache 2.4。我尝试使用提到的here

步骤添加mod_wsgi

但是当我添加行

LoadModule wsgi_module modules/mod_wsgi-py34-vc10.so

Apache无法启动。

5 个答案:

答案 0 :(得分: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应用程序。

答案 1 :(得分:2)

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

答案 2 :(得分:2)

如果您仍然找到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。

答案 3 :(得分:1)

@LarryMartell 我在Windows上遇到了同样的问题并修复了它。 您可以尝试将文件apr_perms_set.hapr存储库(https://github.com/traviscross/apr)复制到Apache2.4的包含文件夹。

答案 4 :(得分:1)

我正在使用64位操作系统,并安装了64位python。

从apachelounge https://www.apachelounge.com/download/安装64位操作系统的apache发行版为我解决了这个问题。