Deploy Python App To Heroku With Extra Pip Install
I'm trying to implement Deploy to Heroku functionality for my Python application: https://github.com/jet-admin/jet-bridge/tree/heroku It woks OK if just use requirements.txt to ins
Solution 1:
The Heroku Python buildpack has a hook where you can execute extra commands after the initial slug compilation.
To use it, you can add a bin/post_compile
file, putting inside the shell commands for installing the extra packages.
You can even make it depend on an environment variable, like:
# assuming you have files mysql-requirements.txt and postgres-requirements.txtif [ "$JET_BRIDGE_DB" == "mysql" ]; thenecho"Installing Python dependencies for MySQL support"
pip install -r mysql-requirements.txt
elseecho"Assuming Postgres database, installing Python dependencies"
pip install -r postgres-requirements.txt
fi
Read more:
- Buildpacks: https://devcenter.heroku.com/articles/buildpacks
- Heroku Python Buildpack: https://github.com/heroku/heroku-buildpack-python
- Slug compilation: https://devcenter.heroku.com/articles/slug-compiler
Post a Comment for "Deploy Python App To Heroku With Extra Pip Install"