loading...
Cover image for Django News App Deployment On Heroku

Django News App Deployment On Heroku

magesh236 profile image Mageshwaran Originally published at dev.to ãƒŧ2 min read

Yesterday I write a post about Building a News App in django, you can find it here

https://dev.to/magesh236/news-app-in-django-2dcd

Now we are going to deploy this django app on heroku

This is the first time I'm trying to deploy django app on heroku

Go to the heroku and signup as a new user, after activating the account you will be redirected to dashboard, it will ask you to create app

Alt Text

after this will you get page like this, with the details how to deploy the project

Alt Text

click the open app, then it will prompt to the url where you will access the news app, for now you will see the default content.
Alt Text

Instructions to deploy apps in heroku
Alt Text

We will use heroku cli to deploy the project, install the heroku cli using this command, i'm using mac it may vary for you, depends which operating system you are using

   brew tap heroku/brew && brew install heroku

To check heroku is installed, use the heroku --version command

   heroku --version
   heroku/7.43.2 darwin-x64 node-v12.16.2

login to heroku cli using this command

   heroku login

go to the root directory of the project in this case newsapp directory

   cd newsapp

and then initialize a git repository

   git init
   heroku git:remote -a APPNAME

same as git, commit the code

   git add .
   git commit -am "first commit"

Deploy your application

   git push heroku master

you may get error in this, You can now change your main deploy branch from "master" to "main" for both manual and automatic deploys.

create a new branch called main

   git checkout -b main

if you want you can delete the old branch

   git branch -D master

in this project deployment I'm not using the static files so I'm disabling it, for further reference check here Collectstatic error while deploying Django app to Heroku

   heroku config:set DISABLE_COLLECTSTATIC=1

Deploy News App Application

   git push heroku main

you can see the status in terminal or in Activity Feed

We made it.... Our app is live.
party

Alt Text

Don't forget to check this post Building a News App in django.

Thanks you, have a great day ahead.ðŸĪŠðŸ˜Ž

Posted on by:

magesh236 profile

Mageshwaran

@magesh236

Software Engineer - Newbie Photography

Discussion

pic
Editor guide