Language:

Search

How to Deploy a Django Project on Ubuntu Using Nginx and Gunicorn

How to Deploy a Django Project on Ubuntu Using Nginx and Gunicorn

Setting up your Django app for production might seem complex, but it doesn’t have to be. This step-by-step guide walks you through deploying a Django web application on Ubuntu, using Nginx as a reverse proxy, Gunicorn as the application server, and either MySQL or PostgreSQL as the database backend.

Whether you're a developer, DevOps engineer, or startup founder, this tutorial will walk you through each step with clarity and confidence.

Prerequisites

Before diving in, make sure you have the following:

  • A cloud server (e.g., AWS EC2, DigitalOcean, Linode) running Ubuntu 22.04+
  • A non-root user with sudo privileges
  • Python 3.8+ installed
  • A Django project ready for deployment
  • Domain name pointed to your server IP (optional but recommended)
  • Basic understanding of Linux commands

Update the Server & Install Required Packages

update server

sudo apt update && sudo apt upgrade -y

install python 

sudo apt install python3-pip python3-dev build-essential libssl-dev libffi-dev python3-venv -y
Tags:
Ahmad Ali

Ahmad Ali

Leave a comment

Your email address will not be published. Required fields are marked *

Your experience on this site will be improved by allowing cookies Cookie Policy