How to Deploy Django Applications on Linode (Ubuntu 20.04 LTS)

Tom Deneire
5 min readApr 22, 2021

I recently deployed a Django application to Linode and had quite some trouble getting everything to run smoothly. Below I offer a step-by-step manual to get things running on a Ubuntu 20.04 LTS image.

Photo by Domenico Loia on Unsplash

Before you start

  • Make sure you have a functional Django app that you have tested with Django’s built-in development server.
  • Execute python3 manage.py makemigrations locally. (We’ll do the follow-up withmigrate in the production environment).
  • Push the complete project (e.g. mysite/)to a remote repository like GitHub or Bitbucket. Make sure you include the migrations folder in your repo (don’t put them in .gitignore !) and a requirements.txt file.

Setup Linode

Create a Linode account and create a new Linode (i.e. a Virtual Private Server):

  • Choose Distribution image: Ubuntu 20.04 LTS (which stands for “Long Term Support” and is more stable than 20.10)
  • Choose region: [pick something close to you]
  • Choose Linode Plan, Label and Root Password
  • Choose Optional Add-ons
  • Press “Create Linode”

When the Linode is created, go to the Network tab and take note of the following data, which we’ll need later on. I’ll be referring to these values as $LINODE_IP_ADDRESSand $HOSTrespectively.

  • Linode IP address (e.g. 119.162.191.84 )
  • Linode Reverse DNS (e.g. li2012-123.members.linode.com)

Change local settings.py

Re-organize your local settings.py file to easily switch from development to production settings, like so. (Take care to replace $HOST )

Connect via SSH

Connect to your Linode via SSH as root. (Take care to wait until your Linode virtual private server has booted and has the status “Running”):