DEV Community

Cover image for Deploy Django application to Heroku using GitHub Actions
Spandan Pal
Spandan Pal

Posted on • Edited on

Deploy Django application to Heroku using GitHub Actions

My Workflow

Alt Text

Hey guys, I have built this website using Django and also used Django Restframework to build an API and implement it there on this site. I configured this project to be deployed on Heroku but each time I commit and push a change to my GitHub repository I have to push it again to Heroku to make the changes visible. Then I came to know about GitHub actions and this is where GitHub actions came into play, I have created a GitHub action which will automatically push the commit to Heroku so that I only need to push my changes to GitHub and my website gets updated on its own.


Alt Text
This is how my newly created GitHub action looked.



Alt Text
And this is after the action ran successfully and did my job.


In case you want to check out this website. Here is the link:
https://spandan-project.herokuapp.com/

Submission Category:

DIY Deployments

Yaml File or Link to Code

GitHub logo spandanpal22 / railway_reservation_sysytem_heroku

In this site you can create your account and access the features of the site. You can search trains, book ,cancel and view your ticket, register complaints and give suggestions also. REST API has been used in making the ticketing section of the site.

Railway_Reservation_System

In this site you can create your account and access the features of the site. You can search trains, book ,cancel and view your ticket, register complaints and give suggestions also. REST API has been used in making the ticketing section of the site.

This site is hosted on: https://spandan-project.herokuapp.com




Top comments (2)

Collapse
 
softwaredevpro profile image
SoftwareDevPro

Where is 'secrets.HEROKU_API_KEY' defined?

Collapse
 
spandanpal22 profile image
Spandan Pal

You will have to open your repo in GitHub first then go to the settings, there you will find secrets. Create a new secret and name the variable like I have named HEROKU_API_KEY and put the value there. The best things about this is only the collaborator can see the value of the secret variables.