【问题标题】:Apache Conf file issue -WSGIPythonPath errorApache Conf 文件问题 -WSGIPythonPath 错误
【发布时间】:2015-07-29 20:23:51
【问题描述】:

所以我正在尝试使用 django、Apache 和 wsgi 部署一个简单的网站。我使用 django 指南 (https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/modwsgi/) 和之前的答案 (Deploying Django on Apache and WSGI) 编写了我的 conf 文件,但是当我重新启动 Apache 时,我在第 3 行收到一个语法错误,说明 WSGIPythonPath 不能出现在 VirtualHost 部分中,一旦删除,Apache 重新启动成功但即使在更改主机文件后仍然不会重定向到我创建的相应 django 网站,以便它重定向回我的服务器。

Apache 版本:2.4.7
Python 版本:2.7.6
Django 版本:1.8.3

<VirtualHost *:80>
    WSGIScriptAlias / /var/www/mywebsite/mywebsite/wsgi.py
    WSGIPythonPath /var/www/mywebsite   

    ServerAdmin my_email@gmail.com
    ServerName mywebsite.com
    ServerAlias www.mywebsite.com

    <Directory /var/www/mywebsite/mywebsite>
    <Files wsgi.py>
    Require all granted
    </Files>
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

【问题讨论】:

  • 欢迎来到 Stack Overflow!如果您在标题中添加更多描述,那么这个问题可能会得到更多关注。
  • 看看这个question。它完全可以解决您的问题。
  • 所以我基本上将 WSGIPythonPath 移动到 apache2.conf 文件中?编辑:好的,我想通了。

标签: python mod-wsgi wsgi


【解决方案1】:

将带有 WSGIPythonPath 的行移至 httpd.conf 位置

【讨论】:

猜你喜欢
  • 2020-05-05
  • 2016-07-15
  • 2019-12-14
  • 1970-01-01
  • 1970-01-01
  • 2020-02-29
  • 2013-07-19
  • 2020-12-24
  • 1970-01-01
相关资源
最近更新 更多