Hosting multiple Django instances on a VPS Hosting multiple Django instances on a VPS nginx nginx

Hosting multiple Django instances on a VPS


Traditional approach

  • Virtualenv is good enough and perfectly ready for production use. You can have multiple virtualenv for multiple projects on the same VM.
  • If you have multiple database engines for multiple projects. Like, MySQL for one, PostgreSQL for another something like this then you just need to set up each individually.
  • Install Nginx and configure each according to project.
  • Install supervisor to manage(restart/start/stop) each project individually.
  • Anything that required by the project.
    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,

  • Use Docker(docker-compose) for local and production deployment.
  • Configure uWsgi with Nginx(Available on docker.)
  • Create a CI/CD pipeline with any tool like Jenkins.
  • Monitor your projects using any good tool like Raygun.

That's it.