We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on Vesta 2.0 and expect to release it by the end of 2024. Read more about it: https://vestacp.com/docs/vesta-2-development
[Solved] WSGI with Python3 for Django
[Solved] WSGI with Python3 for Django
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
Re: [Solved] WSGI with Python3 for Django
This is fantastic. I'm going to try to figure out how to do the same with RHEL / Centos.
So far:
Then the template that you provided doesn't work in RHEL / Centos. I tried using one that I found after a bit of Googling (https://itproffi.ru/zapusk-proektov-django-v-vestacp/) but with that, I always get the same message: "Error: httpd restart failed". I also think there's an error (although it is probably not the cause of the error) in the wsgi.sh, as it is trying to add the .ru domain to the condition in:
So far:
Code: Select all
yum install python26 uwsgi uwsgi-plugin-python36
Code: Select all
RewriteCond %{HTTP_HOST} ^www.$2\.ru\$ [NC]
Re: [Solved] WSGI with Python3 for Django
I think I will never know how to do it, since I'm not using Centos anymore... :/
Re: [Solved] WSGI with Python3 for Django
So you moved on to Debian/ubuntu side?
Yeah, that's because it is only for a specific domain, not using VESTA variables and so, take a look at my code.
Should try Vesta on RHEL/CEntOS but not having time this days.
Re: [Solved] WSGI with Python3 for Django
I found Centos easier and more robust for servers, but for a series of reasons I stopped using it. I might return to use Centos very soon, I will try again then.
Re: [Solved] WSGI with Python3 for Django
I'm still having problems with this.
Trying to set up a brand new server, I always get the same error when adding a domain: "Error: apache2 restart failed".
I really want to set up a Django site in my server, but I can't manage to make it work... :/ What a pity.
Trying to set up a brand new server, I always get the same error when adding a domain: "Error: apache2 restart failed".
I really want to set up a Django site in my server, but I can't manage to make it work... :/ What a pity.
Re: [Solved] WSGI with Python3 for Django
There is a new commit on this:
For more info:
https://gitlab.com/neyder/vestacp-wsgi/merge_requests/1
For more info:
https://gitlab.com/neyder/vestacp-wsgi/merge_requests/1