Deploying your Django application has never been easier as deploying on Heroku cloud platform. Heroku provides a seamless experience for deploying a web application. Heroku does one thing and does it well i.e. deploying web application with fewer steps.
Let's take a look how heroku deploys our application, it provides us an option to connect our github repository and then it automatically triggers a build and deploy our application with every code check in, this way it provides a minimal CI/CD pipeline for our development process.
These are some key steps that should be followed while deploying your app on Heroku.
First step would be creating an account on heroku and creating an app for your django application.
After creating app on heroku dashboard , we can start configuring our app.
Go to deploy tab and connect your github repository with this app and heroku will automatically detect our application by seeing some specific files.
In this above we can see that my github repository is connected with this app. Heroku looks for two files in our repository root directory.
First heroku will install all dependencies from requirements.txt and then will move on to Procfile.
In Procfile the command under release will be run before every deployment since we need to migrate our database before every deployment therefore this command is necessary.
The command under web is the command that should start our application and will receive web traffic. Since heroku deploys our application inside a container called dyno in heroku's term, it becomes necessary to note that our data will not persist across deployments.
Heroku provides a logs console that displays all the deployment related logs , we should go through these logs to confirm that our app is successfully deployed and we can go to the url provide by heroku to test if our app is working is excepted.
For more clarification please go through my github repo to check directory structure and other changes for heroku deployment.
This website is currently deployed on heroku cloud platform.
Happy Coding !!!