You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/azure-app-configuration/quickstart-python-provider.md
+13-10Lines changed: 13 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -174,32 +174,35 @@ Add the following key-values to the App Configuration store. For more informatio
174
174
175
175
## Web app usage
176
176
177
-
You can use Azure App Configuration in your existing python Web Apps by adding the following lines of code into your `settings.py` (For Django) or `app.py` (for Flask) files.
177
+
### [Django](#tab/django)
178
+
You can use Azure App Configuration in your existing Django web apps by adding the following lines of code into your `settings.py` file
To update individual configuration settings in the Django `settings.py` file, you can reference them from the provider object. For example:
188
186
```python
189
-
MESSAGE=config.get("message")
187
+
MESSAGE=CONFIG.get("message")
190
188
```
191
189
192
-
### Configuration settings in Flask
190
+
### [Flask](#tab/flask)
191
+
You can use Azure App Configuration in your existing Flask web apps by updating its in-built configuration. You can do this by passing your App Configuration Provider object to the `update` function of your flask app instance in `app.py`:
193
192
194
-
You can update the in-built configuration object in Flask by passing your App Configuration Provider object to the `update` function of your flask app instance in `app.py`:
#NOTE: This will override all existing configuration settings with the same key name.
197
-
app.update(config)
198
+
app.config.update(azure_app_config)
198
199
199
200
# Access a configuration setting directly from within flask configuration
200
201
json_value = app.config.get("my_json")
201
202
```
202
203
204
+
---
205
+
203
206
Full code samples on how Azure App Configuration is used in python web apps can be found in the [Azure App Configuration Python Samples](https://github.com/Azure/AppConfiguration/tree/main/examples/Python) repo.
0 commit comments