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
  • deployment_targets: [render] selected 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)
services:
  - type: web
    name: your-project
    env: python
    plan: starter
    buildCommand: "./deploy/render/build.sh"
    startCommand: "gunicorn config.wsgi:application"
    envVars:
      - key: PYTHON_VERSION
        value: 3.14
      - key: DJANGO_SETTINGS_MODULE
        value: config.settings.prod
      - key: DATABASE_URL
        fromDatabase:
          name: your-project-db
          property: connectionString
      - key: REDIS_URL
        fromDatabase:
          name: your-project-redis
          property: connectionString

databases:
  - name: your-project-db
    plan: starter
    databaseName: your_project
    user: your_project_user

  - name: your-project-redis
    plan: starter

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_PUBLIC_KEY=your-stripe-public
STRIPE_SECRET_KEY=your-stripe-secret

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 deployment_targets: [render], 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:

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

# Install Python dependencies
pip install -r requirements.txt

# Run database migrations
python manage.py migrate

# Collect static files
python manage.py collectstatic --no-input

Adding Background Workers

Celery Worker

Update render.yaml:

services:
  - type: web
    # ... web service config ...

  - type: worker
    name: your-project-celery
    env: python
    plan: starter
    buildCommand: "pip install -r requirements.txt"
    startCommand: "celery -A config worker -l info"
    envVars:
      # Same env vars as web service
      - key: DATABASE_URL
        fromDatabase:
          name: your-project-db
          property: connectionString

Celery Beat (Scheduled Tasks)

  - type: worker
    name: your-project-celery-beat
    env: python
    plan: starter
    buildCommand: "pip install -r requirements.txt"
    startCommand: "celery -A config beat -l info"
    envVars:
      # Same env vars as web 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
    env: python
    plan: starter

Deploy staging separately from production.

Troubleshooting

Build Fails

Error: "ModuleNotFoundError" - Check requirements.txt includes all dependencies - 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 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