I have deployed my Flask app to Azure web app service. Locally I have a .env
file which contains:
.env file
SECRET_KEY=122345
from dotenv import load_dotenv
from os import environ
load_dotenv()
class config:
SECRET_KEY = environ.get('SECRET_KEY')
I created an environment variable in the "Environment variables" section of the Azure web app.
Name: SECRET_KEY
value: 123456789
But this is failing to work. How do you set an environment variable in Azure?
I have deployed my Flask app to Azure web app service. Locally I have a .env
file which contains:
.env file
SECRET_KEY=122345
from dotenv import load_dotenv
from os import environ
load_dotenv()
class config:
SECRET_KEY = environ.get('SECRET_KEY')
I created an environment variable in the "Environment variables" section of the Azure web app.
Name: SECRET_KEY
value: 123456789
But this is failing to work. How do you set an environment variable in Azure?
Share Improve this question edited Feb 17 at 21:25 marc_s 755k184 gold badges1.4k silver badges1.5k bronze badges asked Feb 17 at 21:16 newdevelopernewdeveloper 7047 silver badges21 bronze badges 6- If you're setting the environment variable, why load a dotenv file? – Mureinik Commented Feb 17 at 21:19
- I had to develop the app in windows, so I used dotenv. But deploying to linux. – newdeveloper Commented Feb 17 at 21:35
- @newdeveloper - Is your issue resolved ? – Harshitha Commented 2 days ago
- Yes, but I can't accept my own answer. – newdeveloper Commented 2 days ago
- @newdeveloper Good to accept any of the solution if it has solved the problem. This is for the benefit of the SO Community, refer SO Link – Naveen Sharma Commented 2 days ago
1 Answer
Reset to default 0Looks like there are two different places to put environment variables. Or it never accepted the values. I re-entered the values and submitted.