Deploying Python Applications on Heroku

  1. Add control / metadata files
    • app.json
      {
       "name": "NAME",
       "description": "DESCRIPTION",
       "repository": "HTTP_PATH_TO_REPO",
       "logo": "HTTP_PATH_TO_LOGO",
       "keywords": [ "KEYWORD1", "KEYWORD2"]
      }
      
    • Profile
      web: gunicorn WSGI_CLASS_TO_LOAD:app
      
    • update requirements.txt to add
      gunicorn
      
    • runtime.txt
      python-3.8.3
      
      git commit -am 'add Heroku files'
      
  2. Log into Heroku
    heroku login
    
  3. Create your Heroku application
    heroku create APP_NAME
    
  4. Push your branch (if master you can just use ‘heroku master’) for deployment
    git push heroku BRANCH:master