Running Flask In Windows Doesn't See Environment Variable
I want to set an environment variable DATABASE_URL that will be read by my Flask app to connect to the database. I use set DATABASE_URL = '...', but I get an error that the variabl
Solution 1:
Just remove spaces from set command
set FLASK_APP=application.py
set FLASK_DEBUG=1
set DATABASE_URL='postgres.......'
More at https://ss64.com/nt/set.html
Solution 2:
A quick idea to try:
On Windows, use
setx
instead ofset
to modify the system environment variables.setx FLASK_APP = application.py
Start a new command processor to see the variables reflected in your environment (They get set when the shell is initialized).
Solution 3:
set FLASK_APP=application.py
set FLASK_DEBUG=1set DATABASE_URL='postgres.......' (WITHOUT THE QUOTATION MARKS, because the system put it automatically, I opened a notepad andset the password andcopy paste andexecutein powershell
Solution 4:
you need to set your path in your pc's environmental varibles. You can find your path of the python here C:\Users"your default user name "\AppData\Local\Programs\Python\Python39. after setting up path use
- pip3 install
Solution 5:
Personally, when i used flask run, i had an issue. I get this message "'flask' is not recognized as an internal or external, operable program or batch file" what could be the issue.
Post a Comment for "Running Flask In Windows Doesn't See Environment Variable"