Encapsulate all of the python packages code in virtual environment
cd /Users/path_to_project/test
# Install virtualenv if you don't already have it
$ sudo pip install virtualenv
$ virtualenv venv # Once installed, create a virtual environment
$ . venv/bin/active # activate it
$ pip3 install Flask # install flask and other packages
Create required files for Heroku
requirements.txt
$ pip3 freeze > requirements.txt # automatically created
Procfile
web: gunicorn app:app
runtime.txt
python-3.6.0 # forces python 3.6 build
Login into Heroku (Create an account if you haven't)
$ heroku login
> Enter your email + password
$ git init
$ heroku git:remote -a <app_name>
# Once remote repository is created, push your changes
$ git add .
$ git commit -m "First Commit"
$ git push heroku master
# it will now build the app, head over to the link on your Heroku dashboard and it's done!
Once deployed, If you need to make changes and install new requirements
# Make changes to the requirements.txt
$ pip3 install -r requirements.txt #Updates the file
$ git add .
$ git commit -m "New Message" # Push all the changes to git
$ git push heroku master # push the changes to production