π Day 10: Django Deployment β Beginnerβs Web Dev Series

Table of contents
- π What Youβll Learn
- π§ 1. Prepare Your Project for Deployment
- π οΈ 2. Use python-decouple for Environment Variables
- βοΈ 3. Update settings.py, urls.py for Static, Media Files
- π 4. Add .gitignore
- π 5. Add collectstatic to Your Flow
- π οΈ 6. Push to GitHub
- π 7. Deploy on Render
- β Task for Day 10
- π You Did It!
- π§βπ» Beginner Resources

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.txt
with GunicornSetting up environment variables with
python-decouple
Using
collectstatic
for 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.txt
Add 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
Subscribe to my newsletter
Read articles from Shankar Lamichhane directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Shankar Lamichhane
Shankar Lamichhane
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.