Configure Heroku project by file listing allowing use of subfolders etc
This is based on https://github.com/timanovsky/subdir-heroku-buildpack
This buildpack looks for two files inside a user specified folder:
PROJECT_PATHenvironment variable in Heroku to point to the corresponding sub directory
The buildpack looks for the MANIFEST files in the subdirectory you configured, copies and moves the required files. Then normal Heroku slug compilation proceeds.
Consider a repository containing multiple Python projects with shared data and library code:
- data/ - data.csv - project1/ - Procfile - requirements.txt - app.py - project2/ - Procfile - requirements.txt - app.py - shared_library/ - utils.py
You wish to deploy only project1 to Heroku. However it is a requirement that the projects Procfile is located in the root directory, while at the same time you have a shared library and dataset.
To deploy project1 to Heroku one would only need to add MANIFEST_GLOBAL and MANIFEST_MV_TO_ROOT to the project1 sub directory where MANIFEST_GLOBAL contains
data/ project1/ shared_library/
and MANIFEST_MV_TO_ROOT contains
The directory structure should now look like
- data/ - data.csv - project1/ - Procfile - requirements.txt - app.py - MANIFEST_GLOBAL - MANIFEST_MV_TO_ROOT - project2/ - Procfile - requirements.txt - app.py - shared_library/ - utils.py
Therefore the deployed build on Heroku will be simply
- Procfile - requirements.txt - data/ - data.csv - project1/ - app.py - MANIFEST_GLOBAL - MANIFEST_MV_TO_ROOT - shared_library/ - utils.py
A standard Procfile for gunicorn will look like:
web: gunicorn sankey_app:server
Since your app is being run from a sub directory you need to tell gunicorn to change to this sub directory first. Your procfile should look like
web: gunicorn --chdir ./project1 app:server
Copy the snippet above into CLI.