I’m moving away from WordPress and into bespoke Python apps.
I’ve settled on Django as my Python framework, my only problems at the moment are concerning hosting. My current shared hosting environment is great for WordPress (WHM on CloudLinux), but serving Django on Apache/cPanel appears to be hit and miss, although I haven’t tried it as yet with my new hosting company. – who have Python enabled in cPanel.
What is the easiest way for me to set up a VPS to run a hosting environment for say, twenty websites? I develop everything in a virtualenv, but I have no experience in running Django in a production environment as yet. I would assume that venv isn’t secure enough or has scalability issues? I’ve read some things about people using Docker to set up separate Django instances on a VPS, but I’m not sure whether they wrote their own management system.
It’s my understanding that each instance Python/Django needs uWSGI and Nginx residing within that virtual container? I’m looking for a simple and robust solution to host 20 Django sites on a VPS – is there an out of the box solution? I’m also happy to develop one and set up a VPS if I’m pointed in the right direction.
Any wisdom would be gratefully accepted.
Andy 🙂
2
Answers
Traditional approach
Here it has a huge drawback. Because you can’t use different versions on your database engine for a different project in an easy way. So, containerization is highly recommended.
For simple and robust solution,
That’s it.
I created a bash script that deploys as many websites as you want on your server. It automatically installs all dependencies on your server, creates a virtual environment, configure Gunicorn, Nginx, and a database for Django, etc. Check it out:
https://github.com/jdbit/django-auto-deploy