[{"data":1,"prerenderedAt":117},["ShallowReactive",2],{"seo-verification":3,"blog-deployer-django-vps-en":6},{"google":4,"bing":5},"EycwPY2XMyTkVzas3n1ygeNJFGAH513qrMjfDljzsMQ","",{"id":7,"slug":8,"title":9,"excerpt":10,"readTime":11,"views":12,"isPinned":13,"publishedAt":14,"category":15,"categories":21,"featuredImage":23,"bgImage":24,"posterImage":25,"relatedSolution":26,"intro":28,"sections":29,"ctaTitle":72,"ctaBody":73,"ctaButton":74,"ctaUrl":75,"relatedPosts":76},44,"deployer-django-vps","Deploy a Django Application on a VPS","Deploy Django on a VPS: Gunicorn, Nginx, PostgreSQL, Docker, and SSL. A complete guide for Python developers who want to self-host.",8,628,false,"2026-05-07T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},4,"Development","developpement","bg-warning\u002F10 text-warning","dev",[22],{"id":16,"name":17,"slug":18,"color":19,"icon":20},null,"\u002Fblog\u002Fcovers\u002Fbg.svg","\u002Fblog\u002Fcovers\u002Fdeployer-django-vps-poster.svg",{"categorySlug":18,"appSlug":27},"django","Django remains the go-to Python framework for robust, secure web applications. Deploying it yourself on a VPS gives you full control over the database, static files, and the scaling pipeline, without depending on an opaque PaaS.",[30,34,44,47,69],{"type":31,"title":32,"body":33},"h2","Why Self-Host Django on a VPS?","Managed platforms for Django bill per usage and hide the server layer, which complicates optimizing migrations, Celery tasks, and large media files. On a VPS, you control the complete stack: Gunicorn as the WSGI server, Nginx at the front, PostgreSQL for data, and Redis for caching and task queues. You decide on the Python version, the number of workers, the static-file collection strategy, and the database tuning. For a production Django application that goes beyond the prototype, this transparency is decisive: you can profile a slow query, adjust PostgreSQL's settings, and deploy a new version with no hidden extra cost.",{"type":35,"title":36,"items":37},"ul","Concrete Benefits of a Self-Hosted Django",[38,39,40,41,42,43],"Full control over PostgreSQL: indexes, VACUUM, persistent connections, and scheduled pg_dump backups.","Asynchronous tasks with Celery and Redis without billing per worker execution.","Fixed, predictable cost, regardless of traffic or the volume of media files served.","Data and logs under your jurisdiction, useful for compliance and auditing.","Freedom of Python version and system dependencies (GDAL, WeasyPrint, Pillow) without buildpack constraints.","Reproducible deployments via Docker and the ability to clone the environment identically.",{"type":31,"title":45,"body":46},"Hardware and Software Prerequisites","For a Django application with PostgreSQL and Redis, plan for at least 2 vCPU and 2 GB of RAM; aim for 4 GB if you add Celery and a busy Redis cache. The recommended OS is Ubuntu 22.04 or 24.04 LTS. Install Docker and Docker Compose to isolate the services, or Python 3.11+ and systemd for a native installation. A domain name pointed via an A record to the VPS IP is required for the TLS certificate. Budget 20 GB of disk for the application, the database, and the media files of a medium-sized project.",{"type":48,"title":49,"steps":50},"steps","Deploy Django Step by Step",[51,54,57,60,63,66],{"title":52,"body":53},"Prepare the VPS and the Project","Connect via SSH, create a dedicated non-root user, and install Docker. Clone your repository and create a `.env` file containing `SECRET_KEY`, `DATABASE_URL`, `ALLOWED_HOSTS=yourdomain.com`, and `DEBUG=False`.",{"title":55,"body":56},"Containerize with Gunicorn","Write a Dockerfile based on `python:3.11-slim`, install the dependencies from `requirements.txt`, then launch the application with `gunicorn projet.wsgi:application --bind 0.0.0.0:8000 --workers 3`. Define a `web` service, a `db` service (PostgreSQL), and a `redis` service in `docker-compose.yml`.",{"title":58,"body":59},"Apply Migrations and Static Files","Run `docker compose run --rm web python manage.py migrate`, then `python manage.py collectstatic --noinput`. Mount a volume for `\u002Fapp\u002Fstaticfiles` and `\u002Fapp\u002Fmedia` so that Nginx can serve them directly.",{"title":61,"body":62},"Configure Nginx as a Reverse Proxy","Create a server block that forwards traffic to `http:\u002F\u002Fweb:8000` via `proxy_pass`, and that serves `\u002Fstatic\u002F` and `\u002Fmedia\u002F` from the volumes. Add the `X-Forwarded-Proto` and `Host` headers so that Django correctly detects HTTPS.",{"title":64,"body":65},"Enable HTTPS with Let's Encrypt","Use Certbot or an `nginx-proxy` container with `acme-companion` to automatically obtain and renew the certificate for `yourdomain.com`. Force the HTTP-to-HTTPS redirect and enable HSTS in Django via `SECURE_HSTS_SECONDS`.",{"title":67,"body":68},"Start and Supervise","Run `docker compose up -d`, check the logs with `docker compose logs -f web`, and create the superuser with `python manage.py createsuperuser`. Schedule a cron job for `pg_dump` backups and the clean restart of Celery workers.",{"type":70,"body":71},"tip","Enable the PgBouncer connection pooler between Django and PostgreSQL: with several Gunicorn workers and Celery tasks, you quickly exhaust Postgres's `max_connections`. PgBouncer in transaction mode multiplies the number of queries served without touching the database tuning, and stabilizes latency under load.","Launch Your Django in Minutes","The ServOrbit Cloud VPS provides a preconfigured template with Docker, Nginx, and automatic SSL certificates, ready to host your Django application, PostgreSQL, and Redis.","Deploy My Django VPS","\u002Fvps-cloud",[77,91,104],{"id":78,"slug":79,"title":80,"excerpt":81,"readTime":82,"views":83,"isPinned":13,"publishedAt":84,"category":85,"categories":86,"featuredImage":23,"bgImage":24,"posterImage":88,"relatedSolution":89},5,"deployer-laravel-vps","Deploying Laravel on a VPS: a production guide","Take Laravel to production on a VPS: PHP, workers, cache, database, reverse proxy and HTTPS configured cleanly.",7,2840,"2026-02-09T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},[87],{"id":16,"name":17,"slug":18,"color":19,"icon":20},"\u002Fblog\u002Fcovers\u002Fdeployer-laravel-vps-poster.svg",{"categorySlug":20,"appSlug":90},"laravel-stack",{"id":92,"slug":93,"title":94,"excerpt":95,"readTime":11,"views":96,"isPinned":13,"publishedAt":97,"category":98,"categories":99,"featuredImage":23,"bgImage":24,"posterImage":101,"relatedSolution":102},43,"deployer-nodejs-vps","Deploy a Node.js Application on a VPS","Deploy a Node.js application to production on a VPS: PM2, Nginx reverse proxy, Let's Encrypt SSL, and automatic startup at boot.",591,"2026-05-08T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},[100],{"id":16,"name":17,"slug":18,"color":19,"icon":20},"\u002Fblog\u002Fcovers\u002Fdeployer-nodejs-vps-poster.svg",{"categorySlug":18,"appSlug":103},"nodejs",{"id":105,"slug":106,"title":107,"excerpt":108,"readTime":82,"views":109,"isPinned":13,"publishedAt":110,"category":111,"categories":112,"featuredImage":23,"bgImage":24,"posterImage":114,"relatedSolution":115},45,"deployer-fastapi-vps","Deploy a FastAPI Application on a VPS","Deploy FastAPI on a VPS with Uvicorn, Gunicorn, Nginx, and SSL. A guide for Python developers who want a self-hosted async API.",665,"2026-05-06T00:00:00+00:00",{"id":16,"name":17,"slug":18,"color":19,"icon":20},[113],{"id":16,"name":17,"slug":18,"color":19,"icon":20},"\u002Fblog\u002Fcovers\u002Fdeployer-fastapi-vps-poster.svg",{"categorySlug":18,"appSlug":116},"fastapi",1785628429201]