【问题标题】:Django with Apache and mod_wsgi on Windows 2008 Server在 Windows 2008 Server 上使用 Apache 和 mod_wsgi 的 Django
【发布时间】:2013-09-26 16:42:45
【问题描述】:

我在使用 Apache 2.2、Django 1.5.4、Python 3.3.2 和 mod_wsgi 3.4 部署站点时遇到问题

这是我的思路。

安装 Apache 后,我将“Hello world”index.html 放入 htdocs 目录,以检查是否设置正确。这里没问题。

我安装了 Python、Django(import django - 没有错误)和 mod_wsgi。 为了检查 wsgi,我做了httpd.exe -e debug 并得到了这个作为回报:

...
[debug] mod_so.c(246): loaded module wsgi_module

比我添加以下到httpd.conf:

WSGIScriptAlias / C:/Program Files (x86)/Apache2.2/htdocs/my_project/my_site/apache/django.wsgi
<Directory C:/Program Files (x86)/Apache2.2/htdocs/my_project/my_site/apache/>
Order deny,allow
Allow from all
</Directory>

此时我无法再启动 Apache - The requested operation has failed! 现在httpd.exe -e debug 返回Syntax error on line 496 of C:/Program Files (x86)/Apache2.2/conf/httpd.conf: Invalid option to WSGI alias definition.

如果需要补充信息,请告诉我。 这是我的第一次体验,非常感谢您的帮助。

【问题讨论】:

    标签: django apache mod-wsgi


    【解决方案1】:

    当您在 Apache 配置中的路径名中有空格时,它们必须被引用。

    WSGIScriptAlias / "C:/Program Files (x86)/Apache2.2/htdocs/my_project/my_site/apache/django.wsgi"
    <Directory "C:/Program Files (x86)/Apache2.2/htdocs/my_project/my_site/apache/">
    Order deny,allow
    Allow from all
    </Directory>
    

    【讨论】:

      猜你喜欢
      • 2019-08-02
      • 2019-05-19
      • 2014-03-02
      • 2014-05-11
      • 1970-01-01
      • 2016-04-17
      • 2012-08-21
      • 2014-11-29
      • 1970-01-01
      相关资源
      最近更新 更多