A production-ready Django boilerplate for quick deployment on Render.com.
- 🚀 Quick deployment on Render.com
- 🔒 Secure configuration with environment variables
- 📊 PostgreSQL database support for production + SQLite for local development
- 🗄️ WhiteNoise for static files serving
- 🌐 ASGI support with Uvicorn
- 🛠️ Debug mode auto-configuration
- Python 3.9+
- pip (Python package manager)
- A Render.com account
- Clone the repository:
git clone https://github.com/gonzamordecki/render-django-boilerplate
cd render-django-boilerplate- Create a virtual environment (use at least python 3.9) and activate it:
python3.9 -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory:
cp .env.example .env- Generate a new secret key and add it to your
.envfile:
python -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"- Run migrations:
python manage.py migrate- Start the development server:
python manage.py runserverVisit http://localhost:8000 to see your app running.
-
Go to render.yaml and change line 10 to your project name (i.e. 'my-django-app')
-
Go to Render and create a new blueprint:
- Connect your GitHub repository
- Give the blueprint a name (i.e. 'my-django-app')
- Click on "Deploy Blueprint"
-
Your service should be live! 🎉
Render will automatically:
- Create a PostgreSQL database
- Generate a secure SECRET_KEY
- Handle static files through WhiteNoise
- Set up HTTPS
django-render-boilerplate/
├── main/ # Project configuration
├── homepage/ # Main app
├── static/ # Static files
├── requirements.txt # Python dependencies
├── build.sh # Build script for Render
├── render.yaml # Render configuration
└── .env.example # Environment variables template
The project uses environment variables for configuration. Key settings:
DEBUG: Automatically set based on the environmentSECRET_KEY: Auto-generated in productionDATABASE_URL: Automatically configured by RenderALLOWED_HOSTS: Configured for Render's domain
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
Created by Gonza Mordecki