I'm trying to deploy a Flask webapp to Heroku and I have seen conflicting information as to which files I need to include in the git repository.
My webapp is built within a virtual environment (venv), so I have a Pipfile
and a Pipfile.lock
. Do I also need a requirements.txt
? Will one supersede the other?
Another related question I have is what would occur if a certain package failed to install in the virtual environment: can I manually add it to the requirements.txt
or Pipfile
? Would this effectively do the same thing as pipenv install ...
or is that doing something else beyond adding the package to the list of requirements (considering Heroku is installing the packages upon deployment).
You do not need
requirements.txt
.The
Pipfile
andPipfile.lock
that Pipenv uses are designed to replacerequirements.txt
. If you include all three files, Heroku will ignore therequirements.txt
and just use Pipenv.If you have build issues with a particular library locally I urge you to dig into that and get everything working on your local machine. But this isn't technically required... as long as the
Pipfile
andPipfile.lock
contain the right information (including hashes), Heroku will try to install your dependencies.