[Solved] WSGI with Python3 for Django
Posted: Tue Feb 26, 2019 4:35 pm
Hi i was needing to use a django app inside a client, so i worked this beacuse official doc and files doesn't work.
This is a first commit, but works swiftly.
This files are meant to enable WSGI support on a Debian or Ubuntu.
Install wsgi apache module
Download wsgi template
Create new package or set wsgi as apache template in the existing package
Add new user and assing him package with wsgi template
Add new domain and check the result
Hints
This is for Python3.
You should create a venv in private dir inside your web domain.
Your project should be alogside venv named as domain_name.
wsgi.py script is inside PROJECTAPP directory
you can rename PROJECTAPP with
this was tested using a django project.
If you want to help this is the repo :
https://gitlab.com/neyder/vestacp-wsgi
This is a first commit, but works swiftly.
This files are meant to enable WSGI support on a Debian or Ubuntu.
Install wsgi apache module
Code: Select all
sudo apt-get install libapache2-mod-wsgi-py3
a2enmod wsgi
Code: Select all
cd /usr/local/vesta/data/templates/web
wget https://gitlab.com/neyder/vestacp-wsgi/-/archive/master/vestacp-wsgi-master.tar.gz \
-O- | sudo tar xzvf - --strip-components=1
Add new user and assing him package with wsgi template
Add new domain and check the result
Hints
This is for Python3.
You should create a venv in private dir inside your web domain.
Your project should be alogside venv named as domain_name.
Code: Select all
private
├── name.domain.tld
└── venv
Code: Select all
private/
└── name.domain.tld
├── manage.py
└── PROJECTAPP
└── wsgi.py
Code: Select all
sudo sed -i 's/PROJECTAPP/{change_this}/' conf/web/name.domain.tld.apache2.conf
sudo sed -i 's/PROJECTAPP/{change_this}/' conf/web/name.domain.tld.apache2.ssl.conf
If you want to help this is the repo :
https://gitlab.com/neyder/vestacp-wsgi