Back to Blog
Django · Deployment

How to Deploy a Django App to Render for Free — Step-by-Step 2026 Guide

Pavan Kiran Nagapuri March 20, 2026 6 min read

Render is the best free platform for deploying Django apps in 2026. It replaced Heroku's free tier and is significantly easier to use. This guide walks you through the complete deployment process — from creating your Render account to getting a live URL — including the common errors that trip up most developers.

Create a Render Account

Go to render.com and sign up with your GitHub account. This is important — connecting GitHub makes deployments automatic. Every time you push to your main branch, Render redeploys automatically.

Configure Your Django Project

Before deploying, your project needs a few additions:

1. Install required packages

pip install gunicorn whitenoise dj-database-url psycopg2-binary
pip freeze > requirements.txt

2. Update settings.py

import dj_database_url
import os

# Allow Render's domain
ALLOWED_HOSTS = ['*']

# WhiteNoise for static files
MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',  # Add this second
    ...
]

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

# Database — uses DATABASE_URL env var on Render
DATABASES = {
    'default': dj_database_url.config(
        default=f'sqlite:///{BASE_DIR}/db.sqlite3',
        conn_max_age=600
    )
}

3. Create a build script

Create build.sh in your project root:

#!/usr/bin/env bash
set -o errexit
pip install -r requirements.txt
python manage.py collectstatic --no-input
python manage.py migrate

Make it executable: chmod +x build.sh

Database Setup

Render's free tier includes a PostgreSQL database (expires after 90 days on free plan). To create one:

  1. In your Render dashboard, click "New" → "PostgreSQL"
  2. Give it a name and select the free plan
  3. Copy the "Internal Database URL" — you'll need this next

Environment Variables

In your Render web service settings, add these environment variables:

Never commit your SECRET_KEY or DATABASE_URL to GitHub. Always use environment variables for sensitive config.

Deploy on Render

  1. In Render dashboard, click "New" → "Web Service"
  2. Connect your GitHub repo
  3. Set these values:
    • Build Command: ./build.sh
    • Start Command: gunicorn yourproject.wsgi:application
    • Plan: Free
  4. Click "Create Web Service" — Render starts building
  5. Watch the build logs — your app is live when you see "Your service is live"

Common Errors and Fixes

Error: "ModuleNotFoundError: No module named 'yourapp'"

Your requirements.txt is missing or outdated. Run pip freeze > requirements.txt again and push.

Error: "DisallowedHost"

Add your Render URL to ALLOWED_HOSTS: ALLOWED_HOSTS = ['yourapp.onrender.com', 'localhost']

Error: Static files not loading (404)

Make sure WhiteNoise is in MIDDLEWARE (second position, after SecurityMiddleware) and collectstatic runs in your build script.

Error: Database connection refused

Check that DATABASE_URL environment variable is set correctly in Render. Use the Internal URL (not External) for services on the same Render account.

Your Live URL

Once deployed, your app is live at https://yourapp.onrender.com. Share it in your portfolio, GitHub README, and LinkedIn. This is exactly how my GoRide app is deployed.

Remember: the free tier spins down after 15 minutes of inactivity. The first request after a cold start takes 30–60 seconds. For production apps, upgrade to a paid plan (starts at $7/month).


Need Help Deploying Your Django App?

I build and deploy Django + React applications for startups and businesses across India.

Get in Touch