Deploy Django
Step-by-step guides for shipping Django to a server, a container platform, or a managed host.
Best for developers moving from local setup to a reliable first production release.
Deploy guides take one hosting route from start to finish: a VPS with Gunicorn and Nginx, Docker Compose, Kubernetes, or a platform such as Render, Fly.io, or AWS. Each one ends with the site live over HTTPS and a way to verify it.
They assume a working Django project and explain every production-specific setting along the way. If you have not chosen where to host yet, start with the hosting comparison, then pick the guide for that route.
Topics in Deploy
Grouped by guide type, then difficulty
Narrow the list by experience level or stack, then work through the matching guides in recommended order.
Foundations guides
Learn the concepts, tradeoffs, and prerequisites before you change production infrastructure.
When you deploy Django in production, you will see both WSGI and ASGI recommended.
Many Django deployments break because static files and media files are treated as the same thing.
Choosing the best hosting for Django deployment is not about finding the cheapest server or the most popular cloud.
Read Django settings from environment variables safely: typed parsing, fail-fast secrets, systemd and Docker env files, and verification.
Connect a domain to a Django server: A and AAAA records, www and apex, CNAMEs for platforms, TTLs, verifying propagation with dig, and matching ALLOWED_HOSTS and certificates.
Compare Gunicorn and uWSGI for serving Django in production: configuration complexity, performance, worker models, features like the uwsgi protocol and emperor mode, maintenance status, and which to choose for new and existing projects.
Compare Gunicorn and Uvicorn for Django: WSGI versus ASGI, when async views and WebSockets need Uvicorn, running Uvicorn workers under Gunicorn, performance for typical database-bound apps, and how to choose.
Compare Nginx and Caddy as the reverse proxy for Django: automatic HTTPS versus Certbot, configuration size, performance, static files, ecosystem and documentation, on-demand TLS for tenants, and which suits your deployment.
Should you deploy Django with Docker or directly on a VPS with systemd? Compare reproducibility, deploy workflow, performance, debugging, security updates, and team skills, with a recommendation for solo developers, small teams, and growing apps.
Compare Heroku alternatives for deploying Django: Render, Railway, Fly.io, DigitalOcean App Platform, Google Cloud Run, AWS App Runner, PythonAnywhere, and self-hosted PaaS like Coolify and Dokku, by workflow, workers, databases, and cost model.
Compare Render, Railway, and Fly.io for hosting Django: build and deploy workflow, workers and cron, managed PostgreSQL, migrations, regions and latency, persistent storage, billing models, and operational effort, with picks for common scenarios.
Compare PostgreSQL and MySQL (and MariaDB) as the database for a Django project: Django feature support, transactional DDL for migrations, JSON, full-text search, extensions, managed hosting, performance, and team experience.
Compare Redis and Memcached as the Django cache backend: data structures, persistence, eviction, multi-purpose use for sessions, Celery, and rate limiting, memory efficiency, scaling, and managed options, with a recommendation.
Compare serving Django static files with WhiteNoise inside the app versus Nginx or a CDN: setup, compression and cache headers, performance, containers and PaaS, media files, and the setup that suits each deployment.
Compare uv, Poetry, and pip with pip-tools for managing Django dependencies in production: lock files, install speed in CI and Docker, reproducibility with hashes, Python version management, and migration paths between them.
Why Django’s manage.py runserver is not for production: single-process design, no security review, static file handling, auto-reload, and DEBUG coupling, plus what to run instead with Gunicorn, Uvicorn, and a reverse proxy.
Store, load, and rotate Django secrets: inventories, file-based secrets, systemd credentials, cloud secret managers, and SECRET_KEY_FALLBACKS.
Compare Kubernetes and Docker Compose for running Django in production: single-host simplicity versus multi-node scheduling, rolling updates, autoscaling, secrets, operational cost, and when a team should move from Compose to Kubernetes.
Compare Celery alternatives for Django background jobs: Django’s built-in tasks framework, django-rq, Dramatiq, Huey, django-q2, and database-backed queues, by setup effort, brokers, scheduling, retries, monitoring, and scale.
Tasks guides
Follow actionable deployment and operations guides you can work through step by step.
A Dockerized Django app that works in development is not automatically safe for production.
It is easy to get a Django app running on Render, but it is also easy to ship an unsafe or incomplete production setup.
If you want to deploy Django on Railway, the main challenge is not just getting a container to start.
A Django app running over plain HTTP is not safe for production. Login sessions, admin access, CSRF tokens, API traffic, and password resets can all be exposed in transit if TLS...
Django does not safely serve static files in production by default. With DEBUG=False, you still need a production path for CSS, JavaScript, fonts, and images collected from your...
Connecting Django to PostgreSQL in production is more than changing the DATABASES setting.
Deploy a Django app to Heroku with Gunicorn, Heroku Postgres, WhiteNoise, a release-phase migration, and production-safe settings.
Deploy an existing Django project on PythonAnywhere with a virtualenv, a correct WSGI file, MySQL, static file mappings, environment variables, and forced HTTPS.
Send Django email reliably in production: SMTP TLS settings, sender addresses, SPF, DKIM and DMARC, timeouts, background sending, and tests.
Run Django management commands on a schedule with systemd timers or cron: environment loading, overlap locks, logging, and failure alerts.
Deploy Django reproducibly with uv: lockfiles, uv sync --locked without dev tools, managed Python, Docker layer caching, and CI checks.
Deploy Django on an AWS Lightsail instance with a static IP, firewall rules, Gunicorn, Nginx, HTTPS, and an optional Lightsail managed PostgreSQL database.
Deploy Django on an Akamai Cloud (Linode) compute instance with a Cloud Firewall, Gunicorn, Nginx, managed PostgreSQL, Object Storage for media, and backups.
Deploy Django on your own server with Coolify: Dockerfile builds from Git, managed PostgreSQL and Redis, automatic HTTPS, environment variables, migrations, and backups.
Deploy Django with CapRover: captain-definition, a Gunicorn Dockerfile, one-click PostgreSQL, container port and HTTPS settings, persistent media, and safe migrations.
Deploy Django on DigitalOcean App Platform with an app spec, Gunicorn, managed PostgreSQL, bindable environment variables, a pre-deploy migration job, and WhiteNoise.
Supervise Gunicorn and Celery for Django with Supervisor: program configs, environment variables, stop signals and timeouts, log rotation, group restarts, and when to prefer systemd.
Build a minified Tailwind CSS file for Django releases: scanning templates and Python code, the standalone CLI without Node, Docker build stages, collectstatic hashing, and missing-class bugs.
Let a Django server pull code from a private GitHub, GitLab, or Bitbucket repository with read-only deploy keys: SSH config aliases, known_hosts, private dependencies, and alternatives.
Ship Django translations reliably: run compilemessages in CI or a Docker build stage with gettext, ignore virtualenvs, validate .po files, restart workers, and verify every language in production.
Deploy a Poetry-managed Django project: lock file checks, installing only main dependencies, in-project virtualenvs, multi-stage Docker builds without Poetry at runtime, and exporting requirements.
Make Django installs reproducible and tamper-resistant with pip-tools: requirements.in, compiled pins with hashes, separate dev requirements, pip install --require-hashes, and safe upgrades.
Deploy a Django app on a Vultr cloud compute instance: choose a plan and region, lock down SSH and the Vultr firewall, install Python, PostgreSQL, Gunicorn, and Nginx, add HTTPS, and set up backups and snapshots.
Run a Django app reliably on a Raspberry Pi 4 or 5: use 64-bit Raspberry Pi OS on an SSD instead of an SD card, run Gunicorn and Nginx under systemd, expose it safely with Cloudflare Tunnel, and back up off the device.
Deploy Django on cPanel shared hosting with Setup Python App and Phusion Passenger: create the app and virtualenv, write passenger_wsgi.py, use MySQL or PostgreSQL, serve static files from public_html, and know the hosting limits.
Deploy Django to your own server with git push production main: a bare repository with a post-receive hook that checks out the code, installs dependencies, runs migrations and collectstatic, and reloads Gunicorn, with safe failure handling.
Store Django uploads on DigitalOcean Spaces with django-storages’ S3 backend: set the regional endpoint, create scoped access keys, choose private files with presigned URLs or public files behind the Spaces CDN, and configure CORS.
Store Django uploads on Backblaze B2 through its S3-compatible API: create a bucket and application key, configure django-storages with the B2 endpoint, serve private files with presigned URLs, and put public files behind Cloudflare.
Run Django manage.py commands against containerised deployments: docker compose exec versus run, kubectl exec versus one-off Jobs, loading the right settings and secrets, interactive shells, and keeping one-off commands out of web containers.
Create the first Django admin user in production non-interactively: createsuperuser --noinput with DJANGO_SUPERUSER_ environment variables, one-off containers and Jobs, PaaS consoles, an idempotent management command, and securing the account afterwards.
Organise Django settings for development, staging, and production: a settings package with base, dev, and prod modules, environment variables for secrets, DJANGO_SETTINGS_MODULE per environment, and tests that keep production settings safe.
Use django-environ to read Django settings from environment variables and .env files: typed values for DEBUG and ALLOWED_HOSTS, DATABASE_URL and CACHE_URL parsing, required variables, safe .env handling, and when to skip .env in production.
Keep a Django staging site private: HTTP basic auth in Nginx or Caddy with health-check and webhook exceptions, Django middleware for PaaS hosts, noindex headers, IP or VPN restrictions, and why basic auth interferes with API tokens.
Deploy a Django app with Portainer: define a Compose stack with web, worker, Postgres, and Redis, pull images from a private registry, set environment variables and secrets, enable Git-based redeploys or webhooks, and add a reverse proxy for HTTPS.
Deploy a Django app on Koyeb from GitHub or a Docker image: configure Gunicorn and the PORT, add a PostgreSQL database, set secrets, health checks, and regions, run migrations safely, serve static files with WhiteNoise, and attach a custom domain.
Deploy Django on Scalingo, the European PaaS: prepare a Procfile with web and postdeploy commands, add the PostgreSQL addon, configure environment variables, static files, and workers, and scale containers while keeping data in EU regions.
Deploy Django on Divio, a cloud platform built around Django and Docker: structure the project for Divio’s Dockerfile, read DEFAULT_DATABASE_DSN and storage DSNs, configure release commands for migrations, and promote changes from test to live environments.
Deploy Django with Dokploy, an open-source self-hosted PaaS: install it on a VPS, create an application from Git with a Dockerfile or Nixpacks, add PostgreSQL and Redis, configure domains with automatic HTTPS, run migrations, and schedule database backups.
Deploy Django with Easypanel, a Docker-based server control panel: create an app service from GitHub with a Dockerfile or buildpacks, add Postgres and Redis services, set environment variables, mount volumes for media, and enable HTTPS on a custom domain.
Put a Docker-based Django app behind Nginx Proxy Manager: create a proxy host with Let’s Encrypt, connect containers on a shared network, forward the right headers, serve static files, allow large uploads, and keep the admin UI private.
Run Huey for Django background tasks and periodic jobs in production: configure the Redis or SQLite storage, start the consumer with workers and the built-in scheduler, avoid duplicate periodic tasks, handle database connections, and supervise it with systemd.
Run Django-Q2 in production: configure the ORM or Redis broker in Q_CLUSTER, start qcluster workers under systemd or containers, manage schedules in the admin, set timeouts and retries correctly, and avoid running duplicate clusters.
Use Upstash serverless Redis with Django for caching, sessions, rate limiting, and Celery: connect over rediss:// with TLS, understand per-request pricing and connection limits, choose regions, and know when the REST API suits serverless deployments better.
Use Cloudinary for Django media uploads: configure django-cloudinary-storage or the Cloudinary SDK, upload user images and video, generate resized and optimized URLs on the fly, sign uploads from the browser, and keep secrets and costs under control.
Use Hetzner Object Storage for Django media and static files with django-storages: create a bucket and S3 credentials, set the regional endpoint and addressing style, choose public or private access with presigned URLs, configure CORS, and keep costs low next to Hetzner Cloud servers.
Use Wasabi S3-compatible storage for Django media and backups with django-storages: set the regional endpoint, create a restricted policy, serve files with presigned URLs or a CDN, and understand minimum storage duration and egress terms.
Put Bunny CDN in front of a Django site: create a pull zone for WhiteNoise static files or an object storage origin, use hashed file names with long cache headers, serve media from Bunny Storage with django-storages, and purge or sign URLs when needed.
Manage Django environment variables and secrets with Doppler: organize projects and configs per environment, inject secrets with doppler run locally and on servers, sync to Heroku, Render, Vercel, or Kubernetes, use service tokens in CI, and rotate safely.
Self-host Uptime Kuma to monitor Django: add HTTP checks against a health endpoint with keyword matching, monitor TLS expiry, use push monitors for Celery beat and cron jobs, send alerts to email, Slack, or Telegram, and publish a status page.
Moving a Django app from local development to production usually fails on the same points: process management, reverse proxy configuration, static files, secrets, TLS, and safe...
If you want to deploy Django ASGI with Uvicorn and Nginx, python manage.py runserver is not a production option.
If you want to deploy Django with Caddy in production, the main challenge is not just putting a reverse proxy in front of the app.
Many Docker Compose examples for Django are built for local development, not production.
If you want to deploy Django on a DigitalOcean Droplet, you need more than python manage.py runserver.
To deploy Django on AWS EC2 reliably, you need more than python manage.py runserver.
A production-safe Fly.io Django deployment needs more than fly launch and fly deploy.
If you want to deploy Django on Google Cloud Run, the basic path is straightforward: build a container and run it. The production-safe part is where most deployments fail.
Running Gunicorn manually for a Django app is fragile. If your SSH session closes, the process can stop.
A production Django stack should not expose Gunicorn or Uvicorn directly to the internet.
Local disk storage for Django media files works in development, but it breaks quickly in production.
Moving a Django app from a local database or self-managed PostgreSQL server to a managed PostgreSQL service sounds simple: update the host, username, and password, then deploy.
Running background jobs in Django production is not just a matter of installing Celery and pointing it at Redis.
Running Celery workers manually in production is fragile. If you start a worker from a shell and disconnect, the process may stop.
Manual Django deployments usually fail in predictable ways: someone forgets to run migrations, static files are outdated, the wrong branch gets pushed to production, or a restar...
Deploy Django to Azure App Service on Linux with Oryx builds, Gunicorn startup commands, Azure Database for PostgreSQL, and secure app settings.
Deploy Django to AWS Elastic Beanstalk with the EB CLI, Gunicorn, RDS PostgreSQL, leader-only migrations, static file mapping, and working health checks.
Provision a Hetzner Cloud server with the hcloud CLI, cloud firewall, and cloud-init, then run Django with Gunicorn, Nginx, PostgreSQL, and backups.
Run a Heroku-style git push deploy for Django on your own server with Dokku, the Postgres plugin, predeploy migrations, persistent media storage, and Let's Encrypt.
Run Django with uWSGI and Nginx: a strict uWSGI ini, socket permissions, systemd integration, graceful reloads, harakiri timeouts, and checks.
Deploy Django on Apache with mod_wsgi daemon mode, a matching virtualenv, static file aliases, secret loading, HTTPS, and code reloads without restarting Apache.
Build a GitLab CI/CD pipeline for Django: PostgreSQL tests, Docker image builds, SSH deploys with protected variables, and one-click rollbacks.
Prepare a Django REST Framework API for production: safe defaults, throttling, pagination, CORS, proxy headers, Gunicorn sizing, and API checks.
Serve a React SPA and a Django API from one domain with Nginx: routing fallback, API proxying, cache headers, and CSRF-safe session auth.
Run several Django projects on one server safely: separate users and virtualenvs, systemd templates, per-site databases, and Nginx blocks.
Configure Django's Redis cache for production: memory limits, eviction, authentication, key prefixes, timeouts, cached sessions, and checks.
Put Django behind Cloudflare correctly: Full (strict) TLS, origin lockdown, real client IPs, HTTPS detection, cache rules, and request limits.
Run Celery Beat reliably for Django: schedules, file or database schedulers, a single instance under systemd, time zones, and monitoring.
Run Django on MySQL or MariaDB in production: mysqlclient, utf8mb4, strict SQL mode, time zone tables, connection timeouts, TLS, and backups.
Store Django uploads on Cloudflare R2 with django-storages: scoped API tokens, STORAGES settings, custom domains, signed URLs, and migration.
Serve Django static files from CloudFront: S3 with origin access control or origin pull, hashed filenames, immutable caching, and CORS.
Build a Django staging environment that catches real release problems: production parity, isolated data and secrets, and safe side effects.
Deploy Django to the Google App Engine standard environment with app.yaml, Gunicorn, Cloud SQL for PostgreSQL, Secret Manager, static handlers, and Cloud Storage media.
Deploy a containerized Django app to Azure Container Apps with Azure Container Registry, PostgreSQL Flexible Server, secrets, a migration job, custom domains, and revisions.
Deploy Django with Gunicorn and Nginx on Rocky Linux, AlmaLinux, or RHEL with SELinux enforcing: firewalld, file contexts, booleans, and reading AVC denials.
Put Traefik in front of a Dockerized Django app: automatic Let's Encrypt certificates, HTTP to HTTPS redirects, Docker labels for routing, static files, and upload limits.
Run Django in production with Granian, the Rust HTTP server for Python: WSGI and ASGI interfaces, workers and threads, a systemd unit, Nginx in front, and when to choose it.
Build a Bitbucket Pipelines CI/CD workflow for Django: tests against a PostgreSQL service, cached dependencies, deployment environments, SSH deploys, and a manual production gate.
Automate Django deployments over SSH with Fabric: a fabfile with release directories, dependency install, migrations, collectstatic, atomic symlink switch, health checks, and rollback.
Use cloud-init user data to provision a Django-ready Ubuntu server on first boot: users and SSH keys, packages, firewall, swap, directories, systemd units, and verification.
Serve a Django app through Cloudflare Tunnel with no open inbound ports: cloudflared setup, ingress rules, DNS routing, real client IPs, HTTPS settings, and protecting the admin.
Deploy a Wagtail site to production: Sites and WAGTAILADMIN_BASE_URL, image renditions and media storage, scheduled publishing, search indexing, document serving, and caching.
Run Django on SQLite in production safely: WAL mode, busy timeout and IMMEDIATE transactions, file placement and permissions, online backups, Litestream replication, and when to move on.
Deploy background work with Django 6's django.tasks: choosing a production backend, enqueueing after commit, running database workers under systemd, scaling, retries, and monitoring.
Serve permission-checked Django downloads efficiently: Django authorises the request and returns X-Accel-Redirect, and an internal Nginx location streams the file without tying up workers.
Send Django email through Amazon SES: domain verification with DKIM, leaving the sandbox, SMTP or django-ses API backends, IAM permissions, custom MAIL FROM, and bounce handling.
Ship Vite-built JavaScript and CSS with Django in production: manifest-based asset tags with django-vite, a Node build stage, collectstatic, cache headers, and avoiding dev-server leaks.
Serve one Django project on www, api, and admin subdomains: per-host URLconfs, host-only cookies, CORS and CSRF settings, Nginx server blocks, and restricting admin access by network.
Build Django images in GitHub Actions, push them to GHCR with immutable tags, pull them on servers with read-only credentials, deploy by tag or digest, and clean up old versions.
Move a live Django project from SQLite to PostgreSQL without losing data: create the schema with migrate, transfer data with dumpdata and loaddata or pgloader, fix content types and sequences, and cut over with minimal downtime.
Deploy Django on Oracle Cloud Always Free resources: create an Ampere A1 Arm instance, open ports in both the security list and the instance iptables, install the stack on Ubuntu, and know the free tier's limits and reclaim rules.
Deploy Django on Windows Server behind IIS: run Waitress through HttpPlatformHandler instead of the unmaintained wfastcgi, serve static files from IIS, run it under an app pool identity, and add HTTPS with an IIS binding.
Deploy a containerised Django app on AWS App Runner: build an image in ECR, configure the port and health check, connect to RDS through a VPC connector, run migrations, serve static files, and know when ECS fits better.
Deploy a Django app on Vercel’s Python runtime: expose the WSGI app, collect static files at build time, use an external PostgreSQL such as Neon, and understand what serverless Django on Vercel cannot do.
Run Django in production with Hypercorn, an ASGI and WSGI server with HTTP/2 and HTTP/3 support: configure workers and worker class, bind behind Nginx, set timeouts and graceful shutdown, and compare it with Uvicorn and Gunicorn.
Run Django on NGINX Unit, the application server configured through a JSON API: configure a Python application with a virtualenv, route static files, set processes, add TLS, and check the project's maintenance status before adopting it.
Configure Django correctly behind an AWS Application Load Balancer: HTTPS listeners with ACM, X-Forwarded-Proto and client IPs, ALLOWED_HOSTS for health checks, idle and keepalive timeouts, stickiness, and deregistration delay for deploys.
Build a Jenkins pipeline for Django: a declarative Jenkinsfile that runs tests against PostgreSQL in Docker, builds and pushes an image, deploys over SSH with migrations, uses credentials binding, and gates production behind approval.
Set up CircleCI for a Django project: a config.yml with a PostgreSQL service image, dependency caching, parallel test splitting, Docker image builds, and an SSH or registry-based deploy job gated by branch filters and approval.
Build an Azure Pipelines YAML pipeline for Django: test with a PostgreSQL service container, publish an image to Azure Container Registry, deploy to App Service or a VM through environments with approvals, and keep secrets in variable groups or Key Vault.
Deploy Django with timestamped release directories and an atomic current symlink: build each release in isolation, share media and env files, switch with ln -sfn, reload Gunicorn gracefully, and roll back instantly to the previous release.
Use RabbitMQ as the Celery broker for Django in production: install and secure RabbitMQ, create a vhost and user, configure the broker URL and quorum queues, set prefetch and acks, and monitor queues with the management plugin.
Run django-rq (Redis Queue) workers for Django in production: configure queues in settings, supervise rq workers with systemd, schedule jobs with rq-scheduler or cron, handle failed jobs, and monitor queues in the admin.
Configure Memcached as Django’s cache in production: choose PyMemcacheCache, size memory and item limits, run several nodes with consistent hashing, secure the port, handle failures gracefully, and know what not to store there.
Connect Django to Cloud SQL for PostgreSQL securely: use the Cloud SQL Auth Proxy or Unix sockets on Cloud Run, private IP inside a VPC, IAM database authentication, connection limits, and running migrations against Cloud SQL.
Use Supabase as the PostgreSQL database for a Django app: choose the direct connection or the Supavisor pooler, handle transaction-mode pooling with server-side cursors off, require SSL, keep Row Level Security from blocking Django, and run migrations.
Use Neon serverless PostgreSQL with Django: pooled versus direct connection strings, cold starts after scale-to-zero, transaction-mode pooling settings, branches for preview environments, and running migrations safely.
Handle Stripe webhooks reliably in a production Django app: verify signatures with the raw body, exempt only the webhook view from CSRF, respond fast and process in Celery, make handlers idempotent with event IDs, and monitor failed deliveries.
Store Django user uploads on Google Cloud Storage with django-storages: create a bucket with uniform access, authenticate with Workload Identity or the runtime service account, serve private files with signed URLs, and set CORS and lifecycle rules.
Store Django uploads in Azure Blob Storage with django-storages: create a storage account and private container, authenticate with managed identity instead of account keys, serve files with SAS URLs, and add Azure CDN or Front Door for public assets.
Load Django secrets such as SECRET_KEY and database passwords from AWS Secrets Manager: inject them into ECS and EKS as environment variables, fetch them at startup with boto3 and caching, grant least-privilege IAM, and rotate RDS credentials.
Keep Django environment secrets encrypted in the repository with Mozilla SOPS and age: encrypt .env and YAML files, decrypt during deploys with Ansible or CI, use cloud KMS keys for teams, and keep keys out of Git.
Remove the Django admin from the public internet by serving it only over Tailscale: install Tailscale on the server, route /admin through a tailnet-only Nginx server block or a separate admin hostname, and keep staff access simple.
Require two-factor authentication for the Django admin in production: django-otp with OTPAdminSite and TOTP devices, recovery codes, enrolling existing staff, passkeys with django-allauth MFA, and avoiding lockouts during rollout.
Deploy a Django REST or Ninja API with a separate Next.js frontend: same-domain routing versus subdomains, CORS and CSRF for cookie auth, server-side fetches from Next.js to Django, environment URLs, and where each part should be hosted.
Take a Django Ninja API to production: choose WSGI or ASGI for sync and async endpoints, lock down the interactive docs, configure authentication, CORS, throttling, and error handling, and validate schemas in CI.
Configure Gunicorn for Django with a gunicorn.conf.py file: bind, workers and threads, timeouts, max_requests with jitter, logging to stdout, forwarded headers, preload trade-offs, and server hooks for database connections.
Use django-anymail to send Django email through an email API such as SendGrid, Postmark, Mailgun, Brevo, or Amazon SES: configure the backend, verify the sending domain, handle tracking webhooks and bounces, and test without sending.
Send Django email outside the request cycle: queue emails with Celery after commit, retry provider failures with backoff, use django-celery-email or a custom backend, keep templates rendered in the task, and avoid duplicate sends.
Migrate a production Django site to a new server or provider with minimal downtime: rebuild the stack from code, copy media with rsync, move PostgreSQL with dump and restore or replication, lower DNS TTL, cut over, and keep the old server as a fallback.
Issue a Let’s Encrypt wildcard certificate for *.example.com to serve Django on many subdomains: DNS-01 challenges with certbot DNS plugins or acme.sh, automatic renewal with provider API tokens, Nginx configuration, and Django host settings.
Write a robust docker-entrypoint.sh for Django: wait for dependencies, optionally run migrations and collectstatic behind flags, support web, worker, and one-off commands, exec the final process for signals, and keep secrets out of logs.
Use one compose.yaml for a Django stack with compose.override.yaml for development and compose.prod.yaml for production: bind mounts and runserver locally, built images, restart policies, and no exposed database ports in production.
Run Django containers as a non-root user: create a dedicated user in the Dockerfile, fix ownership of app, static, and media paths, handle volume permissions, bind high ports, and add a read-only root filesystem and dropped capabilities.
Pass Django secrets to containers as files instead of environment variables: Docker Compose and Swarm secrets mounted at /run/secrets, the _FILE convention, reading them in settings, and keeping secrets out of images and docker inspect.
Schedule Django management commands on Kubernetes with CronJobs: concurrencyPolicy Forbid, time zones, startingDeadlineSeconds, history limits, resource requests, secrets, and monitoring missed or failed runs, compared with Celery Beat.
Deploy a Django app on DigitalOcean Kubernetes: build and push to DigitalOcean Container Registry, connect to Managed PostgreSQL and Valkey, expose it with a load balancer and HTTPS, run migrations as a Job, and store media in Spaces.
Deploy Django on a Google Compute Engine VM: create an e2 instance with a service account, install Gunicorn and Nginx, connect to Cloud SQL through the Auth Proxy, store media in Cloud Storage, open firewall rules, and add HTTPS.
Deploy Django on Northflank: build from Git with a Dockerfile or buildpack, add PostgreSQL and Redis addons, share configuration with secret groups, run migrations as a job in a release flow, add Celery workers, and expose the app with a custom domain.
Deploy Django on Upsun, formerly Platform.sh: write the application, services, and routes configuration, run collectstatic in the build hook and migrate in the deploy hook, read service credentials from relationships, and use mounts and preview environments.
Build production Django container images without a Dockerfile using Cloud Native Buildpacks and the pack CLI: choose a builder, configure Python version and start command with a Procfile, run collectstatic, rebase images for OS patches, and use it in CI.
Run Django in production with mod_wsgi-express: install mod_wsgi with pip into the virtualenv, generate a self-contained Apache configuration, serve static files, run it under systemd, and put it behind Nginx or use it directly on port 80.
Run Django on a Windows server with Waitress: install it in a virtualenv, serve the WSGI app on a port, run it as a Windows service with NSSM, put IIS or Caddy in front for HTTPS and static files, and tune threads and logging.
Deploy a django CMS site to production: configure settings for CMS and filer, PostgreSQL, media on object storage, static files, caching of rendered pages and menus, search engine friendly URLs, and a release process for template and plugin changes.
Deploy the Saleor headless e-commerce platform, built on Django and GraphQL, to production: run the API container with PostgreSQL and Redis, configure Celery workers, media storage, secrets, allowed hosts and CORS for the dashboard and storefront, and run migrations on upgrade.
Run Celery on Heroku with a Django app: add a worker process type, use Heroku Key-Value Store or another Redis as the broker with TLS, schedule periodic tasks without running beat on several dynos, size concurrency to dyno memory, and handle SIGTERM restarts.
Run Celery workers and beat for a Django app on Render background workers, Railway services, and Fly.io process groups: share the image and environment, connect a Redis broker, keep beat to one instance, and handle shutdowns and scaling on each platform.
Use Amazon SQS as a Celery broker for Django: install the SQS transport, authenticate with IAM roles, create queues, set visibility timeout and long polling, handle FIFO limitations, and avoid surprises with ETA tasks, results, and costs.
Run Dramatiq background workers for Django in production with django-dramatiq: choose Redis or RabbitMQ, configure middleware for retries, time limits, and results, run workers under systemd or containers, schedule periodic jobs, and shut down safely.
Use Procrastinate, a PostgreSQL-based task queue, with Django in production: install the Django contrib app, define and defer tasks inside transactions, run workers with concurrency, schedule periodic tasks, use locks and queueing locks, and monitor jobs in the admin.
Use Valkey, the open-source Redis fork, with Django: connect Django’s Redis cache backend or django-valkey, run Celery and Channels against it, migrate from Redis with replication or snapshots, and use managed Valkey on AWS, Google Cloud, and DigitalOcean.
Connect Django to Amazon ElastiCache for caching, sessions, and Celery: choose Valkey or Redis OSS, serverless or node-based clusters, enable TLS and AUTH or IAM, use the primary endpoint, configure security groups, and handle failovers and cluster mode.
Connect Django to Azure Database for PostgreSQL Flexible Server: choose public or private access, require TLS, use Microsoft Entra authentication with managed identity, enable built-in PgBouncer, allow extensions, and configure high availability and backups.
Use Litestream to continuously replicate a Django SQLite database to S3-compatible storage: enable WAL mode, run Litestream as a sidecar or systemd service, restore on startup in containers, test point-in-time recovery, and know the limits of single-writer SQLite.
Run Meilisearch for Django search in production: deploy it with a master key and persistent storage, index models from signals or Celery, use scoped API keys for frontend search, configure filterable and sortable attributes, and rebuild indexes safely.
Use Typesense with Django in production: run a Typesense node or cluster with an API key and persistent data, define collection schemas, sync models from Celery, use scoped search keys in the frontend, and rebuild collections with aliases for zero downtime.
Use Infisical, an open-source secrets manager, for Django: organize projects and environments, inject secrets with infisical run, authenticate servers and CI with machine identities, sync to Kubernetes and platforms, and self-host or use Infisical Cloud.
Load Django secrets from Google Cloud Secret Manager: mount secrets as environment variables or files on Cloud Run, read them with the Python client on Compute Engine and GKE, grant least-privilege access to service accounts, and rotate secrets with versions.
Load Django secrets from Azure Key Vault: use Key Vault references in App Service and Container Apps, read secrets with azure-identity and managed identities, mount them on AKS with the Secrets Store CSI driver, and rotate values without redeploying code.
Use AWS Systems Manager Parameter Store for Django configuration and secrets: store SecureString parameters under a path per environment, inject them into ECS task definitions, read them with boto3 on EC2 and Lambda, grant least-privilege IAM, and compare with Secrets Manager.
Put the Django admin behind Cloudflare Access (Zero Trust): create a self-hosted application for /admin, require SSO or email one-time codes, validate the Cf-Access-Jwt-Assertion header in Django, and block direct origin access so nobody can bypass it.
Set up CrowdSec to protect a Django server: install the agent and Nginx or firewall bouncer, parse Nginx and Django login logs, detect brute force on /admin and login views, share blocklists, and avoid banning legitimate users behind proxies.
Put AWS WAF in front of a Django app on an ALB, CloudFront, or API Gateway: start with AWS managed rule groups in count mode, add rate-based rules for login and API endpoints, exclude rules that break uploads or admin forms, and log and tune blocked requests.
Run GlitchTip, the open-source Sentry-compatible error tracker, for Django: deploy it with PostgreSQL and Redis, point the standard sentry-sdk at a GlitchTip DSN, set up uptime checks and alerts, manage event retention, and keep it secure.
Instrument a Django app with New Relic: install the Python agent, run Gunicorn and Celery under newrelic-admin, configure app names and environments, track transactions, database queries, and errors, add deploy markers, and control data ingest costs.
Use Vector to collect Django, Gunicorn, Nginx, and Celery logs from files, journald, or Docker, parse JSON logs, drop noise and redact secrets, enrich with host and environment, and send them to Loki, Elasticsearch, S3, or a hosted log service.
Use cert-manager to issue and renew Let’s Encrypt certificates for a Django app on Kubernetes: install it with Helm, create a ClusterIssuer with HTTP-01 or DNS-01, request certificates through Ingress or Gateway annotations, and troubleshoot stuck challenges.
Structure Django Kubernetes manifests with Kustomize: a base with Deployment, Service, and migration Job, overlays for staging and production with replicas, resources, and hosts, image tags set from CI, ConfigMap generators with hash suffixes, and use with Argo CD.
Choose how to serve Django static files on Kubernetes: WhiteNoise inside the app image, an Nginx sidecar sharing an emptyDir, a separate static image, or object storage with a CDN, and avoid shared volumes, stale files, and collectstatic at pod start.
Build a Buildkite pipeline for Django: run tests with PostgreSQL on self-hosted agents using the Docker Compose plugin, build and push images, gate production deploys with block steps, run migrations, and keep secrets out of pipeline YAML.
Set up Woodpecker CI, a lightweight self-hosted CI engine, for Django: write .woodpecker.yaml pipelines with a PostgreSQL service, run tests and linting, build and push images with the buildx plugin, deploy over SSH on main, and manage secrets.
Replace long-lived AWS access keys in GitHub Actions with OpenID Connect: create the GitHub OIDC provider and an IAM role with a trust policy scoped to your repo and branch, assume it with aws-actions/configure-aws-credentials, and push to ECR and deploy ECS.
Use Gitea Actions or Forgejo Actions, GitHub Actions-compatible CI built into self-hosted forges, for Django: register act_runner, write workflows with a PostgreSQL service, push images to the built-in container registry, and deploy over SSH with secrets.
Manual Django deployment usually starts simple and becomes unreliable fast. You SSH into a server, pull code, install packages, update environment variables, run migrations, res...
Run Django on AWS ECS Fargate with an ECR image, Secrets Manager credentials, an Application Load Balancer, one-off migration tasks, and safe rolling deploys.
Deploy Django on Kubernetes with a Deployment, Service, Ingress, Secrets, readiness and liveness probes, and a migration Job that runs before each rollout.
Deploy a Dockerized Django app with Kamal 2: deploy.yml, secrets, kamal-proxy HTTPS, a Postgres accessory, safe migrations, health checks, and rollbacks.
Deploy Django Channels in production with Daphne, a Redis channel layer, systemd, and Nginx WebSocket proxying, while Gunicorn keeps serving regular HTTP traffic.
Put PgBouncer between Django and PostgreSQL: transaction pooling, SCRAM auth, pool sizing, compatible Django settings, and monitoring.
Deploy Django with Docker Swarm: a stack file with replicas, Docker secrets, rolling start-first updates with automatic rollback, one-off migrations, and Nginx in front.
Run Django in rootless Podman containers managed by systemd with Quadlet: container, network, and volume units, Podman secrets, health checks, and auto-updates.
Package Django for Kubernetes with a Helm chart: values per environment, Deployment and Ingress templates, a pre-upgrade migration hook, config checksums, and helm rollback.
Deploy Django to Kubernetes with Argo CD: a config repository, an Application with automated sync, PreSync migration hooks, CI-driven image tag updates, and rollback by git revert.
Prepare a Django GraphQL API (Strawberry or Graphene) for production: disable the IDE and introspection, limit depth and aliases, mask errors, batch queries, and log operations.
Deploy a schema-per-tenant Django SaaS with django-tenants: wildcard DNS and TLS, Nginx for subdomains, migrate_schemas in releases, tenant-aware caching, media, Celery, and pooling.
Let browsers upload large files straight to S3 with presigned POST policies: size and type limits, bucket CORS, server-side confirmation, FileField wiring, and cleanup of abandoned uploads.
Spin up a temporary Django environment for every pull request: GitHub Actions, Docker Compose on a preview host, wildcard subdomains, per-PR databases with seed data, and automatic teardown.
Build Django images for both amd64 and arm64 (Graviton, Ampere, Apple Silicon) with docker buildx: QEMU versus native runners, wheels, caching in GitHub Actions, and verifying manifests.
Run Django migrations exactly once per release on Kubernetes: a Job per image tag, waiting for completion in CI, lock timeouts, why init containers are risky, and handling failures.
Deploy a GeoDjango app: GDAL, GEOS, and PROJ libraries on servers and in Docker, enabling PostGIS on self-hosted and managed PostgreSQL, spatial indexes, backups, and upgrades.
Run Django under a subpath such as example.com/app behind Nginx: forward SCRIPT_NAME correctly, set FORCE_SCRIPT_NAME, STATIC_URL, and cookie paths, and avoid broken admin links, redirects, and CSRF errors.
Deploy Django to AWS Lambda with Zappa or a container image and the Lambda Web Adapter: package size limits, static files on S3, database connections with RDS Proxy, cold starts, and when serverless Django is a poor fit.
Deploy Django on GKE Autopilot: push images to Artifact Registry, connect to Cloud SQL with the Auth Proxy sidecar and Workload Identity, expose HTTPS with a Gateway or Ingress and managed certificates, and run migrations as a Job.
Deploy Django on Amazon EKS: build images in ECR, expose the app through an ALB with the AWS Load Balancer Controller and ACM certificates, connect to RDS, grant AWS access with Pod Identity, sync secrets, and run migrations as Jobs.
Run Django on a single-node k3s Kubernetes cluster: install k3s, use the bundled Traefik ingress with cert-manager for Let's Encrypt, keep PostgreSQL outside the cluster or back it up properly, and deploy with manifests or Helm.
Put HAProxy in front of several Django app servers: active health checks on a /health/ endpoint, TLS termination, X-Forwarded-Proto, connection limits per server, rolling deploys with drain, and stick tables for basic rate limiting.
Provision Django infrastructure with Pulumi in Python: define a VPC, database, container service, and secrets as code, manage stacks for staging and production, keep secrets encrypted in config, and preview changes before applying.
Deploy Django on AWS with the Cloud Development Kit in Python: an ApplicationLoadBalancedFargateService, RDS PostgreSQL, Secrets Manager, S3 media, and a migration task, with cdk diff and cdk deploy in CI.
Scale Celery workers on Kubernetes by queue length with KEDA: install KEDA, define a ScaledObject with the Redis or RabbitMQ scaler, scale to zero for batch queues, and shut workers down gracefully so tasks are not lost.
Run Elasticsearch or OpenSearch as the search backend for a Django app: choose managed or self-hosted, connect with django-opensearch-dsl or django-elasticsearch-dsl, index asynchronously with Celery, secure the cluster, and plan reindexing.
Use the official django-mongodb-backend in production: connect to MongoDB Atlas or a replica set, set ObjectId primary keys, handle migrations and contrib apps, configure indexes, transactions, and connection pooling, and know its current limitations.
Connect Django to Amazon RDS PostgreSQL or Aurora with IAM database authentication instead of a static password: grant rds_iam, create an rds-db:connect policy, generate auth tokens in a custom database backend, and require TLS.
Run MinIO as self-hosted S3-compatible storage for Django uploads: deploy it with Docker Compose or systemd, create a bucket and scoped user, configure django-storages, put MinIO behind Nginx with TLS, and back it up.
Use HashiCorp Vault for Django secrets: read KV secrets with hvac using AppRole or Kubernetes auth, render them with Vault Agent or the Vault Secrets Operator, issue dynamic PostgreSQL credentials, and handle lease renewal and restarts.
Store and search embeddings with pgvector in a production Django app: enable the extension with a migration, use VectorField, build HNSW indexes without blocking writes, tune memory, batch embedding generation in Celery, and plan for index size.
Let SaaS customers point their own domains at a multi-tenant Django app with automatic HTTPS: Caddy on-demand TLS with an ask endpoint in Django, domain verification, tenant lookup by Host, and protecting against abuse and rate limits.
Route HTTPS traffic to Django on Kubernetes with the Gateway API or a maintained Ingress controller: HTTPRoutes or Ingress rules, TLS with cert-manager, forwarded headers, body size and timeouts, and moving off the retired ingress-nginx.
Deploy Django on Azure Kubernetes Service: push images to Azure Container Registry, connect to Azure Database for PostgreSQL with workload identity and Key Vault secrets, expose it through Application Gateway or an ingress, and run migrations as Jobs.
Deploy Django on NixOS: define Gunicorn, PostgreSQL, Redis, Nginx, and ACME certificates in configuration.nix, package the app with a Python environment, manage secrets with agenix or sops-nix, and roll back safely with generations.
Deploy Django on FreeBSD 14: install Python, PostgreSQL, and Nginx from packages, run Gunicorn as an rc.d service with daemon(8), configure pf firewall rules, get certificates with acme.sh or certbot, and optionally isolate the app in a jail.
Deploy Django on HashiCorp Nomad: write a job with web, worker, and migration tasks, pull Docker images, inject secrets from Vault or Nomad Variables with templates, register services, route traffic through Traefik or Consul, and roll out safely.
Deploy Django on OpenShift: build with Source-to-Image or a Dockerfile, run as an arbitrary non-root UID, connect to PostgreSQL, expose the app with a Route and TLS edge termination, run migrations as a Job, and fix permission errors under restricted SCCs.
Run Django on Amazon Aurora PostgreSQL: choose provisioned or Serverless v2 capacity, use writer and reader endpoints with a database router, add RDS Proxy for connection pooling and faster failover, set minimum ACUs, and plan upgrades and backups.
Run Django on CockroachDB with the django-cockroachdb backend: match backend and Django versions, configure TLS connections, handle transaction retries, adjust migrations and primary keys, and understand what works differently from PostgreSQL.
Run Django on Microsoft SQL Server or Azure SQL with mssql-django: install the ODBC driver in Docker or Linux, configure the connection and encryption, handle collation and Unicode, migrations, and connection pooling, and know the backend’s limitations.
Require mutual TLS client certificates for Django admin, internal APIs, or partner integrations with Nginx: create a private CA, issue client certificates, configure ssl_verify_client, pass verified identity to Django, and handle revocation and renewal.
Use WireGuard to connect Django app servers to PostgreSQL, Redis, and workers across hosts or providers: generate keys, configure wg0 interfaces, bind databases to the tunnel address, restrict firewalls, and keep Django connection settings on private IPs.
Use Varnish as an HTTP cache in front of Django: send correct Cache-Control headers from views, write VCL that bypasses logged-in users and POST requests, strip tracking cookies, purge or ban pages on content changes, and run Varnish with Nginx for TLS.
Put Fastly in front of Django: configure the origin and host header, cache anonymous pages with Surrogate-Control and surrogate keys, bypass logged-in users, purge by key from Django signals, and set shielding, TLS, and compression for static files.
Use SigNoz, an open-source OpenTelemetry-native observability platform, with Django: install OpenTelemetry instrumentation, export traces and metrics over OTLP, ship logs with trace IDs, self-host SigNoz or use SigNoz Cloud, and build dashboards and alerts.
Use External Secrets Operator to load Django secrets from AWS Secrets Manager, Google Secret Manager, Azure Key Vault, Vault, or Infisical into Kubernetes Secrets: configure a SecretStore with workload identity, map keys, set refresh intervals, and roll pods on change.
Build a minimal, shell-less production image for Django using a multi-stage build with a Debian builder and a distroless or Chainguard Python runtime: copy the virtualenv, run as non-root, handle collectstatic and migrations without a shell, and debug safely.
Sign Django container images with Sigstore Cosign in CI using keyless signing through GitHub Actions OIDC, attach SBOM and provenance attestations, and verify signatures before deploy or with a Kubernetes admission policy.