简体   繁体   中英

Flask run not recognizing python-dotenv on windows

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.

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.

.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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM