Deploying a Django app on Heroku in a few minutes

Or you can clone this:

To deploy your Django app on Heroku, you will need the following things to install on your computer:

  1. Git
  2. Heroku (as of writing the article, Heroku CLI isn’t available on WSL 1.0)

Open command prompt in windows as administrator and type

heroku login

this opens up your browser and sign in to your Heroku account,

after login in from the browser, you will be prompt to go back into the terminal to check for login

then in your command line, install the following assets

pip install gunicorn
pip install django-heroku

then in the file of your project paste

import django_heroku

on the top and


at the end of the file

After the installing them, inside your folder, create a file name “Procfile”, in Vs code, the symbol will turn like this, there should be no extension like .txt or .py to it, the Heroku symbol will automatically appear if you have Heroku CLI installed properly

After creating the PROCFILE, open it and paste the following code inside it:

web: gunicorn [replace the square brackets and the contents with the name of your django project].wsgi

the .wsgi file exists in your project folder, inside a folder with the name of your project

then in the command line, give the command

pip freeze

this will show you the list of all python packages installed on your computer

Create a file named “requirements.txt” and paste your packages inside the file

now navigate to your projects folder inside the terminal and give the command

heroku create [name of your app on heroku]
heroku git:remote -a [heroku app name]

without the square brackets, this will create your app with the same app name that you just gave and will give you a link, save the link somewhere

then initialize a git inside your project by

git init

to view status

git status

to push all your project to the staging area

git add — all

( those are double minus sign in front of all )

then push your commit to the local repository by

git commit -m “some comment that you give”

and finally, give the command

git push heroku master

your whole project will now be pushed to your Heroku git repository

Congrats, now open your website and you will see the front page

if you have set anything to your default link

but now, even though the website is up and running, database migration hasn’t been completed, so give the command

heroku run bash

and you will be connected to the command line of your Heroku Linux server

now the run the migration command:

python migrate

Now all migration will be applied and you are good to go.

type exit to disconnect from remote server terminal and you’re all done.

I hope you were successful :

Follow me on



Pre Final Year | CSE undergrad