如何在 Windows 上为 apache 2.4 和 python 3.4 安装 mod_wsgi? [英] How to install mod_wsgi for apache 2.4 and python 3.4 on windows?

查看:31
本文介绍了如何在 Windows 上为 apache 2.4 和 python 3.4 安装 mod_wsgi?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用 xampp 安装了 apache 2.4.我尝试使用提到的步骤添加 mod_wsgi 这里

I had apache 2.4 already installed with xampp.I tried adding mod_wsgi using the steps mentioned here

但是当我添加行时

LoadModule wsgi_module modules/mod_wsgi-py34-vc10.so

Apache 没有启动.

Apache does not start.

推荐答案

最好用代码自己构建 mod_wsgi,而不是使用网络上的任意二进制文件.步骤如下.

It is better to build mod_wsgi yourself from code rather than use an arbitrary binary off the net. The steps are as follows.

  • Ensure you have a decent Apache installation which includes header files, e.g. Apache 2.4.37 Win64 from Apache Lounge . Preferably installed at location of C:/Apache24.

确保您的 Python 安装已设置好,以便您可以 pip 安装模块.这必须包括具有该 Python 版本所需的正确 Microsoft C 编译器.

Ensure your Python installation is set up so that you can pip install modules. This must include having the correct Microsoft C compiler needed by that Python version.

运行 pip install mod_wsgi.如果您的 Apache 安装不在 C:/Apache24,则首先将环境变量 MOD_WSGI_APACHE_ROOTDIR 设置为其位置.确保将路径指定为 C:/Apache24 形式而不是反斜杠,也就是说,不是 C:Apache24.这仅在安装时需要,以后不需要.

Run pip install mod_wsgi. If your Apache installation is not at C:/Apache24, then first set the environment variable MOD_WSGI_APACHE_ROOTDIR to its location. Ensure you specify path as C:/Apache24 form and not with back slashes, that is, not as C:Apache24. This is only needed when doing the install, not later.

运行 mod_wsgi-express module-config.

将运行 mod_wsgi-express module-config 的输出复制到您的 Apache 配置文件中.

Copy the output from runing mod_wsgi-express module-config into your Apache configuration file.

将 WSGI 应用程序的配置添加到 Apache 配置中.

Add configuration for a WSGI application to the Apache configuration.

重启 Apache 看看是否能正常工作.

Restart Apache and see if it works.

请注意,在最初测试时,最好从 WSGI hello world 开始,而不是使用一些庞大的 Django 应用程序.

Note that you are better off starting with a WSGI hello world rather than some huge Django application when initially testing.

这篇关于如何在 Windows 上为 apache 2.4 和 python 3.4 安装 mod_wsgi?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆