Skip to content

Render Deployment

Deploy Django Keel projects to Render with zero configuration.

Overview

Render is a modern Platform-as-a-Service (PaaS) that provides:

  • Zero configuration - Detects render.yaml automatically
  • Auto-deploy - Deploy on every git push
  • Managed services - PostgreSQL, Redis included
  • Automatic HTTPS - Free SSL certificates
  • Free tier - Great for MVPs and side projects
  • Web service + Workers - Run web and Celery in one project

Prerequisites

  • Render account (free tier available)
  • GitHub repository with your Django Keel project
  • render selected in deployment_targets during generation

Quick Start

1. Connect GitHub Repository

  1. Go to Render Dashboard
  2. Click "New" → "Blueprint"
  3. Connect your GitHub account
  4. Select your Django Keel repository

2. Configure Blueprint

Render automatically detects render.yaml in your repository root:

# render.yaml (generated by Django Keel, abridged)
services:
  - type: web
    name: your_project
    runtime: python
    plan: starter
    branch: main
    buildCommand: "./deploy/render/build.sh"
    preDeployCommand: "./release.sh"
    startCommand: "gunicorn config.wsgi:application"
    healthCheckPath: /health/
    envVars:
      - key: DJANGO_SETTINGS_MODULE
        value: config.settings.prod
      - key: PYTHON_VERSION
        value: "3.14"
      - key: DJANGO_SECRET_KEY
        generateValue: true
      - key: DEBUG
        value: False
      - key: DATABASE_URL
        fromDatabase:
          name: your_project-db
          property: connectionString
      - key: REDIS_URL
        fromService:
          name: your_project-redis
          type: redis
          property: connectionString

  - type: redis
    name: your_project-redis
    plan: free
    maxmemoryPolicy: noeviction

  # Included automatically when Celery is enabled
  - type: worker
    name: your_project-celery-worker
    runtime: python
    plan: starter
    buildCommand: "./deploy/render/build.sh"
    startCommand: "celery -A config worker -l info"

databases:
  - name: your_project-db
    databaseName: your_project
    plan: free

3. Add Environment Variables

In Render Dashboard → Environment:

# Required
DJANGO_SECRET_KEY=your-secret-key-here
DJANGO_ALLOWED_HOSTS=your-app.onrender.com

# Optional (if using these features)
AWS_ACCESS_KEY_ID=your-aws-key
AWS_SECRET_ACCESS_KEY=your-aws-secret
AWS_STORAGE_BUCKET_NAME=your-bucket

SENTRY_DSN=your-sentry-dsn
STRIPE_TEST_PUBLIC_KEY=pk_test_...
STRIPE_TEST_SECRET_KEY=sk_test_...

4. Deploy

Click "Apply" - Render will:

  1. Provision PostgreSQL database
  2. Provision Redis instance
  3. Build your application
  4. Run migrations
  5. Collect static files
  6. Deploy your application

Your app will be live at https://your-project.onrender.com

Project Structure

When you generate with render in deployment_targets, you get:

your-project/
├── render.yaml              # Render blueprint
└── deploy/
    └── render/
        ├── build.sh         # Build script
        └── README.md        # Deployment instructions

Build Process

The deploy/render/build.sh script handles (uv projects):

#!/usr/bin/env bash
set -o errexit

# Install uv and dependencies
pip install uv
uv sync --frozen

# Collect static files
python manage.py collectstatic --noinput

# Run migrations
python manage.py migrate --noinput

The blueprint also runs ./release.sh as preDeployCommand before each deploy goes live.

Background Workers

When you generate with Celery enabled, the blueprint already includes a your_project-celery-worker worker service - no manual setup needed.

For scheduled tasks, add a beat worker alongside it in render.yaml:

  - type: worker
    name: your_project-celery-beat
    runtime: python
    plan: starter
    buildCommand: "./deploy/render/build.sh"
    startCommand: "celery -A config beat -l info"
    envVars:
      # Same env vars as the worker service

Custom Domains

  1. Go to your service → Settings
  2. Click "Add Custom Domain"
  3. Enter your domain (e.g., www.yourapp.com)
  4. Add CNAME record to your DNS:
    CNAME www your-project.onrender.com
    
  5. Render automatically provisions SSL certificate

Database Backups

Render automatically backs up PostgreSQL databases on paid plans:

  • Starter Plan: Daily backups (7 days retention)
  • Standard Plan: Daily backups (30 days retention)
  • Pro Plan: Daily backups + point-in-time recovery

Manual Backup

# Install Render CLI
brew install render

# Backup database
render db backup your-project-db

# Download backup
render db backup download your-project-db backup-id

Monitoring

Logs

# View logs via CLI
render logs your-project

# Or in dashboard
# Dashboard → Your Service → Logs

Metrics

Render provides built-in metrics:

  • Request rate
  • Response time
  • Memory usage
  • CPU usage

Access in Dashboard → Your Service → Metrics

Scaling

Vertical Scaling (Upgrade Plan)

  1. Dashboard → Service → Settings
  2. Change "Plan" dropdown
  3. Click "Save"

Plans: - Starter: 512 MB RAM - Standard: 2 GB RAM - Pro: 4 GB RAM - Pro Plus: 8 GB RAM

Horizontal Scaling

# render.yaml
services:
  - type: web
    name: your-project
    numInstances: 3  # Run 3 instances
    plan: standard

Render load balances automatically across instances.

Environment-Specific Settings

Staging Environment

Create a separate Render service for staging:

# render.staging.yaml
services:
  - type: web
    name: your-project-staging
    branch: staging  # Deploy from staging branch
    runtime: python
    plan: starter

Deploy staging separately from production.

Troubleshooting

Build Fails

Error: "ModuleNotFoundError" - Check pyproject.toml includes all dependencies and uv.lock is committed - Verify Python version matches (default: 3.14)

Error: "collectstatic failed" - Ensure DJANGO_SETTINGS_MODULE=config.settings.prod - Check AWS S3 credentials if using S3 storage

Database Connection Issues

Error: "could not connect to server"

# Verify DATABASE_URL is set correctly
render env your-project | grep DATABASE_URL

Memory Issues

Error: "Out of memory" - Upgrade to Standard plan (2 GB RAM) - Check for memory leaks in application code - Optimize queryset usage (use select_related())

Migration Issues

Error: "relation already exists"

# Reset database (WARNING: deletes all data)
render db reset your-project-db

For production, use --fake migrations:

python manage.py migrate --fake app_name migration_name

Cost Optimization

Free Tier Usage

  • Web Service: 750 hours/month (1 instance)
  • PostgreSQL: 90 days free, then $7/month
  • Redis: 90 days free, then $10/month

Tips

  1. Use a single worker for Celery (Starter plan)
  2. Combine services where possible
  3. Use disk storage instead of S3 for small projects
  4. Suspend staging environments when not in use

Production Checklist

Before going live:

  • [ ] Set DEBUG=False in environment variables
  • [ ] Configure DJANGO_ALLOWED_HOSTS with your custom domain
  • [ ] Set strong DJANGO_SECRET_KEY
  • [ ] Enable Sentry for error tracking
  • [ ] Set up database backups (Standard plan or higher)
  • [ ] Configure custom domain with SSL
  • [ ] Test Celery workers are processing tasks
  • [ ] Review security headers in config/settings/prod.py
  • [ ] Set up monitoring alerts
  • [ ] Document deployment process for your team

Comparison with Other Platforms

Feature Render Heroku Railway
Free Tier 750 hrs/month No free tier $5 trial credit
Setup render.yaml Procfile Railway UI
Database Included Add-on ($5+) Included
Redis Included Add-on ($15+) Included
Auto-deploy ✅ Yes ✅ Yes ✅ Yes
Custom Domains ✅ Free SSL ✅ Free SSL ✅ Free SSL
Pricing $7+/month $5-$25+/month $5+/month

Best Practices

  1. Use Infrastructure as Code - Keep render.yaml in version control
  2. Separate Staging/Production - Use different Render services
  3. Monitor Resource Usage - Upgrade before hitting limits
  4. Automate Backups - Use Render CLI for automated backups
  5. Review Logs Regularly - Set up log aggregation (Papertrail, Logtail)
  6. Use Environment Groups - Share env vars across services
  7. Health Checks - Render uses /health/ endpoint automatically

Further Reading

Support