Deploying Your Web App

Put a Django API and React frontend live like a team would: Docker, PostgreSQL, container platforms, your own server, tasks, logs and auto-deploys.

  • 0 students
  • 91 lessons
  • 7 h 11 min

Created by Ayim Nelson

What you will learn

  • Prepare Django settings, secrets and PostgreSQL for production, with tested backups
  • Run Django with Gunicorn, and package it with Docker and Docker Compose
  • Deploy to a container platform with a release command and a health check
  • Set up your own Ubuntu server with Gunicorn, systemd, Nginx and HTTPS
  • Move slow work to background tasks with Django's tasks framework and a worker
  • Use logs, error alerts and uptime checks to hear about problems first
  • Build and host a React frontend on Netlify, Vercel or GitHub Pages, with the right API address
  • Deploy automatically with GitHub Actions and keep packages up to date

About this course

Getting a site online once is a start. Keeping it fast, safe and up to date is what real teams do. In this course you take the Akwaaba Blog, its JSON API and a small React frontend, and run them the way most Django projects run today: packaged with Docker, served by Gunicorn with PostgreSQL, deployed to a container platform or to your own Ubuntu server behind Nginx, with background tasks, logs, error alerts, backups and automatic deploys from GitHub. Every file shown was really built and run, and every output shown is real.

For: anyone who finished The Ultimate Django Course and REST APIs with Django REST Framework, or already has a Django project with an API. Knowing Git and a little React helps. The exercises are Python programs that run in your browser; the deploy steps happen on your own computer, a host and a server.

By the end: you'll have a Dockerfile and Compose setup for the blog, settings ready for production, a container platform configuration, a server set up with Gunicorn, systemd, Nginx and HTTPS, a task worker, logging and error alerts, a frontend on a static host, and GitHub Actions that test and deploy it all.

Course content

11 sections · 91 lessons

Getting ready to go live7 lessons
Production settings and Gunicorn10 lessons
  • Settings for each environmentReading · 4 min
  • Where .env files are readReading · 3 min
  • One URL for the databaseReading · 4 min
  • Keeping secrets secretReading · 3 min
  • Checking production settingsReading · 4 min
  • Gunicorn: the application serverReading · 4 min
  • Configuring GunicornReading · 3 min
  • How many workers?Reading · 4 min
  • Static files at build timeReading · 3 min
  • Check the env fileExercise · 15 min
PostgreSQL and backups7 lessons
  • Why not SQLite in production?Reading · 3 min
  • Connecting Django to PostgreSQLReading · 3 min
  • Migrations on every deployReading · 4 min
  • Migrations that don't break the live siteReading · 4 min
  • Backing up with pg_dumpReading · 4 min
  • Testing a restoreReading · 3 min
  • Plan the backup rotationExercise · 15 min
Packaging the app with Docker8 lessons
  • What Docker isReading · 4 min
  • The Akwaaba DockerfileReading · 4 min
  • Layers and the build cacheReading · 4 min
  • Building and running an imageReading · 4 min
  • Several containers with ComposeReading · 4 min
  • The web and worker servicesReading · 3 min
  • Starting everything with docker compose upReading · 4 min
  • Check a DockerfileExercise · 14 min
Container platforms9 lessons
  • How container platforms workReading · 4 min
  • A health check endpointReading · 4 min
  • Health checks behind HTTPSReading · 3 min
  • A Render BlueprintReading · 4 min
  • The worker and database on RenderReading · 3 min
  • Fly.io's fly.tomlReading · 4 min
  • Railway and other dashboardsReading · 3 min
  • Your own domain on a platformReading · 3 min
  • Simulate a health checkExercise · 12 min
Your own Linux server13 lessons
  • What a VPS isReading · 3 min
  • Logging in with SSH keysReading · 4 min
  • Updates and a firewallReading · 3 min
  • Installing the piecesReading · 4 min
  • Getting the code onto the serverReading · 4 min
  • Gunicorn under systemdReading · 4 min
  • systemctl and journalctlReading · 4 min
  • Nginx in front of GunicornReading · 4 min
  • Reading a 502 Bad GatewayReading · 3 min
  • A domain and HTTPSReading · 4 min
  • Telling Django about HTTPSReading · 3 min
  • A deploy scriptReading · 4 min
  • Check the Nginx configExercise · 14 min
Background tasks8 lessons
  • Work that shouldn't make readers waitReading · 3 min
  • Django's tasks frameworkReading · 4 min
  • Enqueueing after the saveReading · 3 min
  • Task backendsReading · 4 min
  • Running the workerReading · 4 min
  • When a task failsReading · 4 min
  • Celery, and jobs on a scheduleReading · 3 min
  • A job queue with retriesExercise · 15 min
Logs and error alerts7 lessons
  • Where logs go in productionReading · 3 min
  • Django's LOGGING settingReading · 4 min
  • Logging from your own codeReading · 3 min
  • Reading the access logReading · 3 min
  • Error alertsReading · 4 min
  • Uptime checks and alertsReading · 3 min
  • Count errors per minuteExercise · 15 min
Hosting the React frontend10 lessons
  • Building the frontendReading · 4 min
  • The API address as a settingReading · 4 min
  • Frontend settings are publicReading · 3 min
  • What a static host doesReading · 3 min
  • Netlify and the page fallbackReading · 4 min
  • VercelReading · 3 min
  • GitHub PagesReading · 4 min
  • Connecting the live frontend to the APIReading · 3 min
  • Letting Django serve the frontendReading · 3 min
  • Check the frontend settingsExercise · 12 min
Automatic deploys and updates9 lessons
  • What continuous deployment isReading · 3 min
  • Testing the backend against PostgreSQLReading · 4 min
  • Deploying only after the tests passReading · 4 min
  • Deploying to your server from GitHub ActionsReading · 4 min
  • Rolling back a bad deployReading · 3 min
  • Keeping packages up to dateReading · 4 min
  • Checking for known vulnerabilitiesReading · 4 min
  • DependabotReading · 3 min
  • Which deploy step failed?Exercise · 12 min
Wrapping up3 lessons
  • A launch day checklistReading · 4 min
  • What you built and where to go nextReading · 3 min
  • Final quizQuiz · 10 min

Reviews

No reviews yet.

Comments

Log in to join the conversation.

Loading comments...