Run Python Project On Port 80 Apache2 Configuration

<VirtualHost *:80>

ServerName domain.com
ServerAlias www.domain.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/(python project folder Name)

<Directory /var/www/html/(python project folder Name)>
AllowOverride All
</Directory>
Alias /static /var/www/html/(python project folder Name)/static
<Directory /var/www/html/(python project folder Name)/static>
Require all granted
</Directory>
Alias /static /var/www/html/(python project folder Name)/media
<Directory /var/www/html/(python project folder Name)/media>
Require all granted
</Directory>
<Directory /var/www/html/(python project folder Name)/(python project folder Name)>
<Files wsgi.py>
Require all granted
</Files>
Require all granted
</Directory>

LoadModule wsgi_module “/var/www/html/myenv/lib/python3.6/site-packages/mod_wsgi/server/mod_wsgi-py36.cpython-36m-x86_64-linux-gnu.so”

WSGIDaemonProcess myenv1 python-path=/var/www/html/(python project folder Name):/var/www/html/myenv/lib/python3.6/site-packages
WSGIProcessGroup myenv1
WSGIScriptAlias / /var/www/(python project folder Name)/(python project folder Name)/wsgi.py

WSGIPassAuthorization On
WSGIApplicationGroup %{GLOBAL}

</VirtualHost>

Leave a Reply

Your email address will not be published. Required fields are marked *