How to Deploy and Host Django in India: Gunicorn, Nginx & VPS Sizing
Django hosting needs a supported Python version, a WSGI server such as Gunicorn, a database and Nginx for static files. Django 5.2 LTS runs on Python 3.10 to 3.14; Django 6.1 needs 3.12 or newer. At WebJi®, Django runs on a self-managed VPS from ₹499 a month before 18% GST.
For developers putting a Django project into production in India who need the version, server and deployment choices in one place.
knowledge
- Read time
- 4 min
- Sections
- 7
- Updated
- 14 Nov 2026
- Written by
- WebJi® team
Last editorial update: 14 November 2026. Prices follow the dated sources on this page; checkout confirms current charges.
What Django hosting needs from a server
Django hosting needs a supported Python version, a virtual environment, a WSGI or ASGI server that stays running, a database and a way to serve static files. Disk size and panel branding do not decide whether the app runs; these six rows do.
| Requirement | Why it matters | Check before buying |
|---|---|---|
| Python version | Each Django release supports a fixed range | A version you can install or select, not just "Python supported" |
| pip and venv | Dependencies install per project | SSH access, or a panel that builds the environment |
| WSGI or ASGI server | Connects the web server to Django | Gunicorn or Uvicorn under systemd, or a panel app manager |
| Database | Migrations need a user that can create tables | PostgreSQL (Django's recommendation) or MySQL/MariaDB |
| Static and media files | collectstatic writes files the web server must serve | A writable path and a web server alias |
| Background processes | Celery workers and Redis must keep running | Root or a persistent process manager |
Which Python version each Django release needs
Django 5.2 LTS supports Python 3.10 to 3.14, while Django 6.0 and 6.1 need Python 3.12 or newer. Check the server's Python before choosing the Django release, because the operating system usually decides it.
| Django | Python | Latest patch | Security support until |
|---|---|---|---|
| 5.2 LTS | 3.10, 3.11, 3.12, 3.13, 3.14 | 5.2.19 | April 2028 |
| 6.0 | 3.12, 3.13, 3.14 | 6.0.10 | April 2027 |
| 6.1 | 3.12, 3.13, 3.14, 3.15 | 6.1.3 | December 2027 |
Django 4.2 LTS lost security support on 7 April 2026, so a project still on it should move to 5.2 LTS. The next LTS, 6.2, is due in April 2027; after it Django switches to year-numbered releases starting with Django 2028.
| Operating system | Default python3 | Newest Django it runs without extra Python |
|---|---|---|
| Ubuntu 22.04 LTS | 3.10 | 5.2 LTS |
| Ubuntu 24.04 LTS | 3.12 | 6.1 |
| Debian 12 | 3.11 | 5.2 LTS |
| AlmaLinux / Rocky 9 | 3.9 (3.11 and 3.12 packages available) | 5.2 LTS or 6.1 with python3.12 |
How to deploy Django on an Ubuntu VPS
Create a virtual environment, install requirements, migrate, collect static files, run Gunicorn under systemd and put Nginx in front. Each step has an output you can check, so a failure shows up where it happens.
- Connect over SSH (see generating an SSH key on Ubuntu) and run
python3 --version. - Clone the project into /var/www/myproject, then run
python3 -m venv venvandsource venv/bin/activate. - Run
pip install -r requirements.txt gunicorn, thenpython manage.py migrate. - Put SECRET_KEY, DEBUG=False, ALLOWED_HOSTS and database credentials in an environment file outside the repository, such as /etc/myproject.env.
- Run
python manage.py collectstatic. - Create the systemd unit and Nginx site below, then issue SSL with Certbot for Nginx.
- Run
python manage.py check --deployand fix each warning it prints.
# /etc/systemd/system/gunicorn-myproject.service
[Unit]
Description=Gunicorn for myproject
After=network.target
[Service]
User=deploy
Group=www-data
WorkingDirectory=/var/www/myproject
EnvironmentFile=/etc/myproject.env
RuntimeDirectory=gunicorn
ExecStart=/var/www/myproject/venv/bin/gunicorn --workers 3 --bind unix:/run/gunicorn/myproject.sock myproject.wsgi:application
[Install]
WantedBy=multi-user.target
# /etc/nginx/sites-available/myproject
server {
listen 80;
server_name example.in www.example.in;
location /static/ {
alias /var/www/myproject/staticfiles/;
}
location / {
include proxy_params;
proxy_pass http://unix:/run/gunicorn/myproject.sock;
}
}
Enable both with sudo systemctl enable --now gunicorn-myproject, link the site into sites-enabled, then sudo nginx -t && sudo systemctl reload nginx. RuntimeDirectory lets the non-root user create its socket under /run. The alias path must match STATIC_ROOT.
Fixing 502, DisallowedHost and CSRF errors after a Django deploy
A 502 means Nginx cannot reach Gunicorn, a 400 means the domain is missing from ALLOWED_HOSTS, and a 403 CSRF failure after adding HTTPS usually means Django does not know the request was secure. The table maps each symptom to its check.
| Symptom | Check | Fix |
|---|---|---|
| 502 Bad Gateway | journalctl -u gunicorn-myproject | Start the unit, or match the socket path in Nginx to Gunicorn's --bind |
| 400 Bad Request (DisallowedHost) | ALLOWED_HOSTS | Add the domain and www, then restart Gunicorn |
| 403 CSRF verification failed | CSRF_TRUSTED_ORIGINS and proxy headers | Add https://example.in to CSRF_TRUSTED_ORIGINS and set SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") |
| Static files 404 | Nginx alias and STATIC_ROOT | Re-run collectstatic and correct the alias |
| Works locally, fails on server | pip freeze on both | Pin versions and rebuild the virtual environment |
SECURE_PROXY_SSL_HEADER is safe only behind a proxy that sets that header itself, as Ubuntu's proxy_params does. If ports still do not answer, check the server firewall with the Linux firewall guide.
Django hosting at WebJi®: what is offered and what is not
WebJi® runs Django on a self-managed KVM VPS from ₹499 a month before 18% GST; there is no published Django or Python shared plan. The VPS-Start sample is 2 vCPU, 4 GB RAM, 60 GB NVMe and 2 TB transfer with root access and a static IPv4, quoted to your operating system and workload.
You own OS updates, backups and the application; support covers the network, hardware and panel, not your code. For a recommendation, send the Python version, the database and whether you use Celery through the Python hosting page or email support@webji.services (24/7, Hindi and English, average first reply under 60 minutes).
Frequently asked questions
Which Django version should a new project use in late 2026?
Django 5.2 LTS if the server has Python 3.10 or 3.11, or you want support until April 2028. Django 6.1 if you have Python 3.12 or newer and will upgrade to 6.2 LTS after its April 2027 release. Avoid starting on 6.0, whose support ends sooner.
How much RAM does a Django app need?
There is no fixed figure. Measure one Gunicorn worker's resident memory with ps after a few requests, multiply by the worker count, then add the database, Redis and Celery. A small app with three workers and PostgreSQL usually fits comfortably within a 4 GB VPS.
Should I use Gunicorn or Uvicorn for Django?
Gunicorn with the WSGI entry point suits standard request-response apps. Use an ASGI server such as Uvicorn when you need async views, WebSockets or Django Channels. Many deployments run Gunicorn with Uvicorn workers to get both under one process manager.
Is PostgreSQL or MySQL better for Django hosting?
Django's documentation recommends PostgreSQL for production, and features such as JSONField queries and full-text search work best there. MySQL and MariaDB are officially supported too. Choose one, keep it on the same server or network as the app, and pin the driver version.
Last editorial update: 14 November 2026. Prices follow the dated sources on this page; checkout confirms current charges.
Ready to get started with WebJi®?
Join 12,000+ businesses across India and overseas. INR pricing, 18% GST shown before payment and 24/7 email support in Hindi and English — average first reply under 60 minutes.