Deploying a Django app on Heroku in a few minutes

Or you can clone this: https://github.com/dev117uday/heroku-django-template

Image for post
Image for post

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

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

Image for post
Image for post

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

Image for post
Image for post

then in your command line, install the following assets

then in the settings.py file of your project paste

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

Image for post
Image for post

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

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

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

Image for post
Image for post

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

Image for post
Image for post

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

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

to view status

to push all your project to the staging area

( those are double minus sign in front of all )

then push your commit to the local repository by

and finally, give the command

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

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

now the run the migration command:

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

Github: https://github.com/dev117uday

Linkedin: https://www.linkedin.com/in/uday-yadav-4995a818a

Sophomore && CSE Undergrad

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store