How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 22.04

Planned Django Linux

Source: How To Set Up Django with Postgres, Nginx, and Gunicorn on Ubuntu 22.04 (DigitalOcean)

Why I saved it

The reference walkthrough for deploying Django on a plain VPS without Docker: PostgreSQL, Gunicorn behind Nginx. Key ideas and my own reformulation come once I've worked through it.

Questions

References

Review cards

Flashcard In the tutorial's setup, what do the Gunicorn systemd socket and service each do?

The socket unit listens on /run/gunicorn.sock and starts the service on the first connection; the service unit runs Gunicorn with the Django app. Nginx proxies requests to the socket. To verify when working through the tutorial.

Quiz Which component is NOT part of the tutorial's bare-server stack?
  • PostgreSQL
  • Nginx as a reverse proxy
  • Gunicorn under systemd
  • Docker Compose

The tutorial installs everything directly on Ubuntu; Docker Compose belongs to the containerized setups elsewhere in the vault.