mardi 22 septembre 2020

Configuring httpd.conf with python Django and mod_wsgi : how to configure so I can access to my url like www.example.com?

I'm working on new personal project that consist on developing a website with python Django framework.

I'm using macOS High Sierra system and I'm trying to follow python tutorial for that.

First we need to configure environment with apache httpd server and mod_wsgi module. I could display "Hello world" script with mod_wsgi application script but I get it with http://localhost url instead of http://www.example.com url... Also, I'm trying to configure it with virtual environment.

The question is how do I need to do into httpd.conf file for that ?

Thank you in advance for your help

Tony

Here is the main configuration for my virtual host :


<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>



Aucun commentaire:

Enregistrer un commentaire