1 min readJun 24, 2020
Deploy A Django app in Heroku
Create your Django with all required functionalities.
Configure the django app (settings.py ) file for Heroku:
(https://devcenter.heroku.com/articles/django-app-configuration)
1.import django_heroku
2.django_heroku.settings(locals())[at the end of the file]
3.pip install gunicorn
For deploying in Heroku
(https://devcenter.heroku.com/articles/django-app-configuration):
- Create a free account in Heroku.
- Install the command line for heroku(using homebrew from their site)
- Create a Requirement.text file in the root directory of the project containing all the dependencies which get insalled before running of the app.(using pip freeze>requirements — it will automatically create the txt file in the root)
- Create a Procfile in the root dir.[web: gunicorn scrape[Project-name].wsgi]
- create a runtime.txt file[python-3.7.4]
- Perform git operation..and do all necessary git commit to the local repo.
- Create Heroku app(->>create heroku news)
- Build the app(->>git push heroku master)
once it is buils and deployed succesfully after installing all the required files from requiremnets.txt
Run:
- >>heroku run python manage.py migrate(Database updated in heroku)
Create superuser(admin)
.>>heroku run python manage.py create superuser
Now,
Ready to launch your url using Heroku.