【问题标题】:Configuring httpd.conf with python Django and mod_wsgi : how to configure so I can access to my url like www.example.com?使用 python Django 和 mod_wsgi 配置 httpd.conf:如何配置以便我可以访问我的 url,如 www.example.com?
【发布时间】:2021-01-08 17:18:42
【问题描述】:

我正在开发一个新的个人项目,包括使用 python Django 框架开发一个网站。

我正在使用 macOS High Sierra 系统,我正在尝试按照 python 教程进行操作。

首先我们需要使用 apache httpd 服务器和 mod_wsgi 模块来配置环境。 我可以使用 mod_wsgi 应用程序脚本显示“Hello world”脚本,但我使用 http://localhost url 而不是 http://www.example.com url 来获取它... 另外,我正在尝试使用虚拟环境对其进行配置。

问题是我需要如何进入 httpd.conf 文件?

提前感谢您的帮助

托尼

这是我的虚拟主机的主要配置:


<VirtualHost *:80>

    ServerName www.example.com
    ServerAlias example.com example
 
    # Chemin a partir duquel le serveur va servir les fichiers, racine a partir de laquelle nous pourrons consulter depuis internet
    DocumentRoot /Users/username/Desktop/example/Site

    # Etapes de configuration du module mod_wsgi.

    # Définie le point d'entrée via le wsgi
    WSGIScriptAlias / /Users/username/Desktop/example/Site/wsgi-scripts/wsgi.py
    # Configuration du monde Daemon
    WSGIDaemonProcess example.com python-home=/Users/username/.local/share/virtualenvs/example-P5vj6Ml3 python-path=/Users/username/Desktop/example
    WSGIProcessGroup example.com

    <Directory /Users/username/Desktop/example/Site/wsgi-scripts>
        <IfVersion < 2.4>
            Order allow,deny
            Allow from all
        </IfVersion>
        <IfVersion >= 2.4>
            Require all granted
        </IfVersion>
    </Directory>

    <Directory /Users/username/Desktop/example/Site/wsgi-scripts>
        <Files wsgi.py>
            Require all granted
        </Files>
    </Directory>
</VirtualHost>

【问题讨论】:

  • 有没有你可以详细解释如何配置的,因为我似乎无法确定 mod_wsgi 的头部或尾部,直到 apache 测试页面我才得到,但在那之后我就完了

标签: django apache web mod-wsgi httpd.conf


【解决方案1】:

好消息,我刚刚忘记配置 DNS。 我将新域本地添加到我的主机文件到 /etc/

【讨论】:

    猜你喜欢
    • 2015-01-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-03
    • 1970-01-01
    • 2011-02-04
    • 2021-11-08
    • 2020-05-25
    相关资源
    最近更新 更多