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.yamlautomatically - 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¶
- Go to Render Dashboard
- Click "New" → "Blueprint"
- Connect your GitHub account
- 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:
- Provision PostgreSQL database
- Provision Redis instance
- Build your application
- Run migrations
- Collect static files
- 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¶
- Go to your service → Settings
- Click "Add Custom Domain"
- Enter your domain (e.g.,
www.yourapp.com) - Add CNAME record to your DNS:
- 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¶
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)¶
- Dashboard → Service → Settings
- Change "Plan" dropdown
- 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"
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"
For production, use --fake migrations:
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¶
- Use a single worker for Celery (Starter plan)
- Combine services where possible
- Use disk storage instead of S3 for small projects
- Suspend staging environments when not in use
Production Checklist¶
Before going live:
- [ ] Set
DEBUG=Falsein environment variables - [ ] Configure
ALLOWED_HOSTSwith 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¶
- Use Infrastructure as Code - Keep
render.yamlin version control - Separate Staging/Production - Use different Render services
- Monitor Resource Usage - Upgrade before hitting limits
- Automate Backups - Use Render CLI for automated backups
- Review Logs Regularly - Set up log aggregation (Papertrail, Logtail)
- Use Environment Groups - Share env vars across services
- Health Checks - Render uses
/health/endpoint automatically
Further Reading¶
Support¶
- Render Support: support@render.com
- Community: Render Community Forum
- Status: status.render.com