I setup a test app to try this out including a PORT=5005 in the .env file and then committing/deploying to Heroku. Heroku didn't seem to notice it was even there and no new config vars appeared when I checked heroku config
.
Will Heroku ignore the .env file?
문제
Our team is using foreman for development and .env files to preassign development ports to each piece of a service oriented application. It dramatically simplifies things for this file to just live with the repository as we are not doing any specific per-machine local configurations even though multiple docs seem to think this is a bad idea.
Does anybody know if Heroku will ignore these .env files automatically? What if they were added to .slugignore?
해결책
다른 팁
You answered your own question, but just for confirmation: .env
is entirely a Foreman construct, while Foreman and Heroku will make use of Procfile
.
We actually wanted to be able to ensure consistent environments between local and Heroku deployments, so I wrote a python script to export .env
up to Heroku.
In case others want to export .env
to Heroku:
https://github.com/FinalsClub/karmaworld/blob/68f0f0340d7b6420e263cab648ff7de1ea851a0e/export_env_to_heroku.py