Skip to content
Hostripples

How to host a Django app

Running Django on your laptop with runserver is easy. Running it for real users needs a few more pieces. This guide outlines a standard, reliable setup on a Linux server.

What you need

  • A server you control. Django needs its own application process running all the time. Our shared hosting plans are built for PHP sites, so for Django use a VPS with root access.
  • Python and a virtual environment for your project and its packages.
  • An application server such as Gunicorn (or Uvicorn for async apps).
  • Nginx in front, to serve static files and pass requests to Gunicorn.
  • A database: PostgreSQL or MySQL instead of SQLite.

The steps, in outline

  • Create a non-root user for the app and connect over SSH.
  • Install Python, create a virtual environment and install your requirements.
  • Set DEBUG to False, set ALLOWED_HOSTS and keep secrets in environment variables.
  • Run migrations and collectstatic.
  • Run Gunicorn as a systemd service so it restarts on its own.
  • Configure Nginx to serve /static/ and /media/ and proxy everything else to Gunicorn.
  • Add a free Let's Encrypt certificate for https.

Keep it running

  • Take a snapshot before upgrading Django or Python packages.
  • Back up the database separately from the server.
  • Watch memory use: each Gunicorn worker is a full copy of your app.
Got Questions?

Frequently asked questions

Short answers to common questions

Our shared plans are built for PHP sites and do not run Python applications. A VPS lets you run Django with Gunicorn and Nginx the way it is meant to run.
A small site runs on a small VPS. Memory is the main limit, because each Gunicorn worker loads your whole app; add RAM as you add workers.
Not for a site with real traffic. Use PostgreSQL or MySQL, which handle many users at once.

Still have a question?

Send us a message and we will point you to the right plan.

Contact us

Get a server for your Django app

NVMe KVM VPS with full root access in India and seven other locations.

See Django hosting