July 3, 2020 Deepak Raj
$ heroku login heroku: Press any key to open up the browser to login or q to exit:
In this tutorial, I will deploy my existing project of GitHub API. It's GitHub API project developed 6 months ago and it's also available on Github and you can clone the repository and try it by yourself.
I will be using Heroku CLI with Git. Your application will be saved in a remote git repository in the Heroku Cloud.
Before starting You Have to add some file to your projects.
Create a file named Procfile in the project root with the following content:
web: gunicorn base.wsgi --log-file -
Note: change base with the name of your Django project.
install Gunicorn in VirtualEnv by command:
$ pipenv install gunicorn $ pipenv install whitenoise
create a filename
Configure the STATIC-related parameters on settings.py:
Add whienoise to settings.py then in the last of MIDDLEWARE List.
Almost all configurations are completed.
clone the Repository here if you haven't downloaded from upper link.
git clone https://github.com/codePerfectPlus/Deploy-Django-Applications-on-Heroku cd Deploy-Django-Applications-on-Heroku
$ heroku login
This will be your app name. appname.herokuapp.com. choose clearly the name for the app.
$ heroku create gitapi-project
Creating ⬢ gitapi-project... done https://gitapi-project.herokuapp.com/https://git.heroku.com/gitapi-project.git
You can simply run
heroku create then Heroku will find the app name by itself.
Now login to Heroku Dashboard and access your recently created app:
Run the following command for the deployment of Django App.
heroku config:set DEBUG_COLLECTSTATIC=1 $ git add . $ git commit -am "make it better" $ git push heroku master
Your Application in Live. Enjoy Your Day, Don't forget to comment.
If you like to write article or Improve this article for CodePerfectPlus mail us at firstname.lastname@example.org
tags: web development, heroku, django