TLDR;
Use PIPENV_DONT_LOAD_ENV=1 pipenv shell
Flask sets/overrides environment variables specified in .env each time flask run is run.
Flask is unaware that the .env file in my project directory has changed and does not refresh it's own environment variables.
The file is read once on startup, there is no caching involved - are you sure you aren't overriding the value in your code?
Please provide a minimal testcase to reproduce your problem.
@ThiefMaster It's possible it's an issue with pipenv? All i'm doing is changing the FLASK_ENV variable in my .env file from production to development and re-running flask run, but not seeing the application change modes.
Solved it! As documented here PIPENV_DONT_LOAD_ENV=1 pipenv shell solved my issue. It must be pipenv trying to optimistically cache .env or perhaps a race condition between pipenv and flask-cli?
Most helpful comment
Solved it! As documented here
PIPENV_DONT_LOAD_ENV=1 pipenv shellsolved my issue. It must bepipenvtrying to optimistically cache.envor perhaps a race condition between pipenv and flask-cli?