🚀 Day 10: Django Deployment – Beginner’s Web Dev Series

Hi, I’m Shankar — a Sr. Software Engineer specializing in Python, Django, and DevOps. I build scalable web applications, APIs, and cloud-native systems, with a focus on clean architecture and backend automation.
Welcome to the final day (Day 10) of your Django web development journey!
Today, we’ll make your project publicly accessible on the internet by deploying it to Render.com, a free and beginner-friendly platform for hosting Django apps.
📍 What You’ll Learn
Preparing your Django app for production
Creating
requirements.txtwith GunicornSetting up environment variables with
python-decoupleUsing
collectstaticfor static file handlingConnecting your GitHub repo to Render
🔧 1. Prepare Your Project for Deployment
Install Gunicorn for production-ready server handling:
pip install gunicorn
Then freeze dependencies:
pip freeze > requirements.txt
🛠️ 2. Use python-decouple for Environment Variables
Install it:
pip install python-decouple
Update settings.py:
from decouple import config
SECRET_KEY = config("SECRET_KEY")
DEBUG = config("DEBUG", cast=bool, default=False)
ALLOWED_HOSTS = ["*"]
Create .env :
SECRET_KEY=your-secret
DEBUG=False
And also create .env.example:
DEBUG=False
SECRET_KEY=changeme
⚙️ 3. Update settings.py, urls.py for Static, Media Files
# settings.py
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
# urls.py
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
📁 4. Add .gitignore
*.pyc
__pycache__/
.env
staticfiles/
db.sqlite3
🔃 5. Add collectstatic to Your Flow
Make sure this is ready in your production setup:
python manage.py collectstatic
This command copies all static files to
STATIC_ROOT, so they can be served in production.
🛠️ 6. Push to GitHub
git init
git add .
git commit -m "Prepare for Render deployment"
git remote add origin https://github.com/yourusername/yourproject.git
git push -u origin main
🌐 7. Deploy on Render
Visit https://render.com
Create a free account
Click New Web Service
Connect your GitHub repo
Select the repo
Wait for it to build and deploy (~3–5 mins)
✅ Task for Day 10
Create a
.env,.env.example, andrequirements.txtAdd Gunicorn to the project
Push your code to GitHub
Deploy to Render
Share your live link with your team/community!
🏁 You Did It!
🎉 Congratulations on completing the 10-Day Django Beginner Series!
You now know how to:
Build dynamic views and templates
Work with models and forms
Handle authentication
Build RESTful APIs
And deploy your Django app to the web
🧑💻 Beginner Resources
1. Official Django Documentation
Best place to learn the right way
Check out the official tutorial
2. MDN Django Tutorial (by Mozilla)
🔗 https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django
Teaches Django through a practical "Library Catalog" app
3. Real Python Django Series
Clear, beginner-to-advanced tutorials with great examples
4. Django for Beginners Book (by William S. Vincent)
Great for beginners building real-world projects step-by-step



