← Back to Blog
Tutorial

How to Deploy Django with PostgreSQL Online

Remoud Team · 6 min read · 2026-02-23

Deploying a Django application can be tricky due to static file collection, WSGI configurations, and migrating from SQLite to a production-grade database like PostgreSQL. This guide simplifies the process entirely.

Prepare Django for Production

Before leaving your local machine, ensure your `settings.py` is configured securely utilizing dj-database-url.

import dj_database_url
import os

DATABASES = {
    'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))
}

ALLOWED_HOSTS = ['*'] # Restrict this later to your specific domain
DEBUG = False # Ensure this is False in production

Serving Static Files

Django doesn't natively serve static files (like CSS, images) in production securely. You should use `WhiteNoise`.

pip install whitenoise
pip freeze > requirements.txt

Add Gunicorn

Django’s built-in server is only for development. Install `gunicorn` to deploy a multi-threaded application server.

Deploying using a Platform

Instead of manually provisioning Linux servers, simply link your GitHub repo to a modern PaaS like Remoud.

  1. Select your repository containing the `requirements.txt`.
  2. Set the start command to `gunicorn your_project.wsgi:application`.
  3. In the Environmental Variables section, define your `DATABASE_URL` pointing to your hosted PostgreSQL database (like Supabase or an AWS RDS instance).
  4. Deploy!

Deploy Python Intelligently

Skip the EC2 manuals. Deploy Django faster and easier with Remoud's Git-driven pipeline.

Start deploying for free →