Bibek Prasad
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):

  1. Create a free account in Heroku.
  2. Install the command line for heroku(using homebrew from their site)
  3. 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)
  4. Create a Procfile in the root dir.[web: gunicorn scrape[Project-name].wsgi]
  5. create a runtime.txt file[python-3.7.4]
  6. Perform git operation..and do all necessary git commit to the local repo.
  7. Create Heroku app(->>create heroku news)
  8. 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.

--

--