Azure App Service: how to to Access Environment Variables in Python Flask App
I can't seem to get I'm stuck on something that should probably be simple. I'm currently working on a Python Flask application hosted on Azure App Service, and I'm having trouble accessing environment variables that I set in the Azure portal. I configured the app settings under 'Configuration' in the Azure portal, creating a key-value pair like `MY_SECRET_KEY=my_secret_value`. However, when I try to access this variable in my Flask app using `os.environ.get('MY_SECRET_KEY')`, it returns `None`. I've confirmed that my Flask app is running in the correct environment and that it's using the same app settings defined in the Azure portal. Here's the relevant part of my code: ```python import os from flask import Flask app = Flask(__name__) @app.route('/') def index(): secret_key = os.environ.get('MY_SECRET_KEY') return f'The secret key is: {secret_key}' if __name__ == '__main__': app.run() ``` I've also tried restarting the App Service after making changes to the app settings, but the scenario continues. When I run this locally, it works fine if I manually set the environment variable. Is there something I'm missing in the Azure configuration? Any insights or troubleshooting steps would be greatly appreciated. For context: I'm using Python on Ubuntu. Any ideas what could be causing this? Thanks for your help in advance! Thanks, I really appreciate it!