Issue Between Django 2.0 / Apache2 And Wsgi
I'm trying to deploy my Django project in my server but I'm encountering some issues. My environment : Ubuntu 16.04 Server Django 2.0 Python 3.5 Apache2 2.4 WSGI Django configura
Solution 1:
HI can you try the below configuration:
import os
from django.core.wsgi import get_wsgi_application
import sys
sys.path.append('/var/www/html/DatasystemsCORE')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "DatasystemsCORE.settings")
application = get_wsgi_application()
Apache2 python wsgi module
sudo apt-get install python3-pip apache2 libapache2-mod-wsgi-py3
<VirtualHost *:80>
ServerName dev.example.com #your server name
ServerAlias dev.example.com #your server alias
DocumentRoot #your document root
WSGIProcessGroup dev.example.com
WSGIPassAuthorization On
WSGIDaemonProcess dev.example.com python-home=/home/robert/django/robertenv python-path=/var/www/html/DatasystemsCORE <Here should be your virtual env path >
WSGIScriptAlias / /var/www/html/DatasystemsCORE/DatasystemsCORE/wsgi.py
Alias /static/ /var/www/html/DatasystemsCORE/static/Theme/ #static directory
<Directory /var/www/html/DatasystemsCORE/static/Theme/>
Require all granted
</Directory>
<Directory /var/www/html/DatasystemsCORE/DatasystemsCORE>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
</VirtualHost>
Use above virtual host configuration
Post a Comment for "Issue Between Django 2.0 / Apache2 And Wsgi"