In this course we take a Django project from development to production using modern deployment practices.
To make this happen, we use Railway's platform services to host and deploy our Django applications with proper configuration. Railway will build, host, and run your container images directly from your code without ever leaving the platform or relying on third party services. What's better, you do not even need to know how to build containers (or even what they are) to deploy on railway thanks to the powerful Nixpacks.
The point? Railway is an incredible platform for deploying software. We just happen to love it to deploy Django, FastAPI, Jupyter, Next.js, Postgres, and much more! Fun fact... the https://cfe.sh website runs on Railway!
The process is simple: write code, push it to GitHub, then Railway will pull code, build images, and host your apps for you. Getting Django ready for production deployments is a key part of this course.
🕹️ References
Code: https://github.com/codingforentrepren...
Django + Railway Guide: https://codingforentrepreneurs.com/bl...
Sign up for Railway: https://kirr.co/wxfp4a (gives me credit) or https://www.railway.com (does not give me credit)
Railway Django Deployment: https://docs.railway.com/guides/django
My Django Template for Railway: https://djangocontainer.com
Django + Gmail for sending email: https://www.codingforentrepreneurs.co...
🚀 Topics include
✅ Setting up Python virtual environments for Django v5.2 (and beyond)
✅ Using Git and GitHub for version control
✅ Configuring Django for production environments
✅ Implementing Gunicorn as a WSGI server
✅ Deploy Django with Nixpacks (the default) to Railway
✅ Deploy Django with a custom Dockerfile to Railway
✅ Managing database migrations and PostgreSQL integration
✅ Handling secrets and environment variables securely
✅ Configuring static files with WhiteNoise
✅ Setting up custom domains with Cloudflare Proxies
✅ Deployed service-to-service communication over a private network (not the public internet)
✅ Creating custom Django management commands
✅ Send emails via Django and Gmail
✅ and much more
Chapters:
00:00:00 Welcome
00:01:12 Python Virtual Environment & Django Hello World
00:06:32 Git + Code Editors
00:11:02 Using the Github CLI & Git to Push Code
00:17:22 Why use Git for Deployment
00:24:18 Django & Github Actions Basics
00:32:21 Handling Secrets and Env Vars
00:41:30 Domain Name Security and Django
00:46:29 Hello World & Health Check Views
00:51:44 Gunicorn Basics Web Server Gateway Interface
00:56:14 Your First Deployment on Railway
01:04:25 Production Env Variables with Railway
01:10:55 Pre-Deploy Migrate Django Database
01:13:39 Postgres in Production & Dev via Railway
01:22:39 Superuser with Custom Django Management Command
01:31:06 Configure Static Files in Django
01:40:40 WhiteNoise with Django & Railway
01:52:53 Sending Email with Django & Gmail
02:02:00 Deploy with a Custom Domain
02:11:29 Deploy with a Dockerfile
02:18:35 Custom Runtime Script for Django Container
02:29:23 Railway Config as Code
02:36:55 Other Django Packages for Production
02:42:16 Private Networking & Jupyter Notebooks
02:48:12 Thank you