2
votes

So I'm running python 3.7 on Windows and I have installed python-dotenv in my virtual environment as well as flask. I have a .flaskenv file in the root of my project where I execute flask run, it looks as if python/flask is not recognizing python-dotenv .flaskenv file it ignores my parameters and states that I do not have a FLASK_APP value assigned. This same setup works fine on a Linux workstation. Is there something different to configure on windows to get this to work?

Thanks ahead of time.

2
I am having the same issue, did you figure this out? I am going the opposite direction and have set up a cookiecutter, but it does not work after I template it. - Jeff Tilton

2 Answers

1
votes

I ran into the same issue and resolved it by executing python -m flask run instead of flask run. The -m allows modules to be located and executed.

0
votes

.flaskenv seems to be working fine on Windows 10. Have you tried creating a new file named .flaskenv, without specifying any extension, in Visual Studio Code? A .flaskenv file of FLASKENV FILE type gets automatically created. I have in there a single line FLASK_APP=yourFileName.py. Hope this helps.