How to install and configure django with postgres nginx and gunicorn

Max Zhang
10 min readFeb 29, 2024

Prerequisites

This tutorial assumes you have already set up your droplet (VPS) with Debian 7 or a similar distro of Linux (such as Ubuntu). If you have not already done this, please follow the tutorial on setting up a droplet here.

For convenience, I’ve broken this tutorial into two parts. The first part (steps 1–6) covers installation only. If you are a more advanced Django user who just needs help getting things installed you can stop at step 6. If you already have everything installed and just want to know how to configure everything, then skip ahead to step 7. If you feel like you need help from start to finish, then just go through the steps in order and you should have no problems. Let’s get started!

Step 1: Update Packages

Before we do anything, we need to make sure that all the packages installed on our VPS are up to date. In order to do this, connect to your desired VPS via SSH and run the following commands:

sudo apt-get update

sudo apt-get upgrade

The first command downloads any updates for packages managed through apt-get. The second command installs the updates that were downloaded. After running the above commands if there are updates to install you will likely be prompted to indicate whether or not you want to install the updates. If this happens, just type “y” and then hit “enter” when prompted.

--

--

Max Zhang

Sincerely thanks for reading! If you like, you can add it to read list and you can tell me which topic article your want to read, I'll write it and share.