Anyway to be able to push to heroku master with Procfile and requirments.txt in a seperate folder

Viewed 68

If I have my Procfile and requirements.txt in the same folder as the file I am running everything works fine. But I am a "neat freak" and like to have everything in organized folders. Is there anyway to have those two files in a seperate folder and still be able to run git push heroku master with no errors?
Or is having them in the root dir the only way?

1 Answers

Not possible if using the official Python buildpack.

The detect script checks for a presence of requirements.txt (or setup.py or Pipfile), see https://github.com/heroku/heroku-buildpack-python/blob/main/bin/detect

Procfile is required in the official Python buildpack.


Possible if you write your own Python buildpack.

You have to adjust the detect and compile to use your requirements.txt in a custom directory. Fork https://github.com/heroku/heroku-buildpack-python/tree/main/bin

The node buildpack does not require a Procfile. It executes npm start by default due to: https://github.com/heroku/heroku-buildpack-nodejs/blob/main/bin/release

#!/usr/bin/env bash
# bin/release <build-dir>

cat << EOF
addons: []
default_process_types:
  web: npm start
EOF

For your custom buildpack you need to add something like that in your release script.

You can set a custom buildpack here: https://i.imgur.com/Kiz8ze3.png
It will show up here: https://i.imgur.com/LNHZAKe.png (Shellinabox is a custom buildpack)

Read more about buildpacks here https://devcenter.heroku.com/articles/buildpacks

Related