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

Hey, I’m Ahmad Ali a tech enthusiast, full-stack web and mobile app developer, and currently working as an Automation Engineer at Nokia. But my curiosity doesn’t stop at the 9-to-5 I’m an all-around tech geek. If it runs on code, connects to a network, or lights up with LEDs... I’m probably into it.

This blog is my digital lab where I mix passion with pixels. Here, you’ll find content on:

  • DIY Electronics & Projects

  • Programming & Automation

  • Data Analysis & Visualizations

  • Telecom & Network Optimization

I’m passionate about solving real-world problems through technology and constantly exploring new tools, languages, and platforms. Whether it’s building smarter systems, automating workflows, or analyzing data for better decisions  I’m always learning, building, and sharing.

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