mirror of
https://github.com/thecyberlearn/modern-django-starter.git
synced 2026-08-18 08:52:55 +00:00
3.1 KiB
3.1 KiB
🚀 Quick Deploy Guide - Zero Changes Needed!
This Django template is designed to deploy without any code changes - just set environment variables!
✅ Clone and Deploy in 3 Steps
Step 1: Clone Repository
git clone https://github.com/your-username/django-template.git
cd django-template
Step 2: Set Environment Variables in Dokploy
Set these 4 required variables in Dokploy environment tab:
DOMAIN_NAME=yourdomain.com
ALLOWED_HOSTS=yourdomain.com,www.yourdomain.com
CSRF_TRUSTED_ORIGINS=https://yourdomain.com
SECRET_KEY=your-secret-key-here
Optional variables:
DEBUG=False
SECURE_SSL_REDIRECT=True
GOOGLE_OAUTH2_CLIENT_ID=your-google-client-id
GOOGLE_OAUTH2_CLIENT_SECRET=your-google-client-secret
Step 3: Deploy
- Dokploy Compose Path:
./docker-compose.dokploy-simple.yml - Domain: Set in Dokploy UI (service=web, port=8000)
- Deploy 🚀
🎯 That's It! No Code Changes Required!
Default Values (works out-of-the-box for testing):
- DOMAIN_NAME:
localhost - ALLOWED_HOSTS:
localhost,127.0.0.1 - CSRF_TRUSTED_ORIGINS:
http://localhost:8000 - SECRET_KEY: Development key (change for production!)
- DEBUG:
True(change toFalsefor production)
What Happens Automatically:
✅ Database migrations run
✅ User groups created (admin, staff, user)
✅ Site configured with your domain
✅ Social apps set up
✅ Static files collected
✅ Gunicorn starts serving your app
🔧 For Different Deployment Platforms
With Docker Database (Default)
- Compose file:
docker-compose.dokploy-simple.yml - Database: Included PostgreSQL container
- Storage: Docker volumes for persistence
With External Database
- Compose file:
docker-compose.dokploy-external-db.yml - Database: Set
DATABASE_URLenvironment variable - Examples: Neon, Supabase, Railway, etc.
🧪 Test Locally First (Optional)
# 1. Set environment variables
export DOMAIN_NAME=localhost
export ALLOWED_HOSTS=localhost,127.0.0.1
export SECRET_KEY=test-secret-key
# 2. Test with Docker
docker-compose -f docker-compose.dokploy-simple.yml up
# 3. Visit http://localhost:8000
🎉 Environment Variable Examples
For myapp.com:
DOMAIN_NAME=myapp.com
ALLOWED_HOSTS=myapp.com,www.myapp.com
CSRF_TRUSTED_ORIGINS=https://myapp.com,https://www.myapp.com
SECRET_KEY=super-long-secret-key-generate-new-one
DEBUG=False
SECURE_SSL_REDIRECT=True
For app.example.org:
DOMAIN_NAME=app.example.org
ALLOWED_HOSTS=app.example.org
CSRF_TRUSTED_ORIGINS=https://app.example.org
SECRET_KEY=another-unique-secret-key
DEBUG=False
SECURE_SSL_REDIRECT=True
⚡ Why This Works
- ✅ No hardcoded domains - everything uses environment variables
- ✅ Sensible defaults - works locally without any setup
- ✅ Production ready - just change a few env vars
- ✅ Platform agnostic - works on Dokploy, Railway, Heroku, etc.
Clone ➜ Set 4 env vars ➜ Deploy ➜ Done! 🚀