- Python 3.6.4
- Virtualenv & autoenv
- Flask
- Gunicorn
- Heroku
- Git & Github
- Run app locally to ensure it works -
python app.py
on URLhttp://localhost:5000/
. - Add changes to git:
git add .
- Commit changes:
git commit -m "Some commit message"
- Push to Heroku:
git push stage master
, andgit push pro master
- Push to Github:
git push
In a .env
file (see autoenv
) we have:
source env/bin/activate
export APP_SETTINGS="config.DevelopmentConfig"
Automatically starts the virtual environment when entering the directory, and sets the DevelopmentConfig environment variables.
For staging run the following command:
$ heroku config:set APP_SETTINGS=config.StagingConfig --remote stage
For production:
$ heroku config:set APP_SETTINGS=config.ProductionConfig --remote pro
And in app.py
:
...
app = Flask(__name__)
app.config.from_object(os.environ['APP_SETTINGS'])
...
...