Skip to content

Commit 854ef75

Browse files
committed
Review comments
1 parent a235b59 commit 854ef75

File tree

3 files changed

+23
-37
lines changed

3 files changed

+23
-37
lines changed

articles/azure-app-configuration/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
- name: ASP.NET Core
166166
href: howto-variant-feature-flags-aspnet-core.md
167167
- name: Python
168-
href: how-to-variant-feature-flags-python.md
168+
href: howto-variant-feature-flags-python.md
169169
- name: Enable Azure monitoring
170170
items:
171171
- name: Monitor App Configuration

articles/azure-app-configuration/how-to-variant-feature-flags-python.md renamed to articles/azure-app-configuration/howto-variant-feature-flags-python.md

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: 'Use variant feature flags application'
2+
title: 'Use variant feature flags in a Python application'
33
titleSuffix: Azure App configuration
44
description: In this tutorial, you learn how to use variant feature flags in an Python application
55
#customerintent: As a user of Azure App Configuration, I want to learn how I can use variants and variant feature flags in my python application.
@@ -11,7 +11,7 @@ ms.topic: how-to
1111
ms.date: 12/02/2024
1212
---
1313

14-
# Use variant feature flags application
14+
# Use variant feature flags in a Python application
1515

1616
In this tutorial, you use a variant feature flag to manage experiences for different user segments in an example application, *Quote of the Day*. You utilize the variant feature flag created in [Use variant feature flags](./use-variant-feature-flags.md). Before proceeding, ensure you create the variant feature flag named *Greeting* in your App Configuration store.
1717

@@ -36,13 +36,20 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
3636
.\venv\Scripts\Activate
3737
```
3838

39-
1. Install the required packages. The latest versions of `azure-appconfiguration-provider`, and `featuremanagement` are required for variant feature flags.
39+
1. Install the latest versions of the following packages.
4040

4141
```bash
42-
pip install flask azure-appconfiguration-provider==2.0.0b3 azure-identity featuremanagement[AzureMonitor]==2.0.0b3 flask-login flask_sqlalchemy flask_bcrypt
42+
pip install flask
43+
pip install flask-login
44+
pip install flask_sqlalchemy
45+
pip install flask_bcrypt
46+
pip install azure-appconfiguration-provider
47+
pip install azure-identity featuremanagement[AzureMonitor]
4348
```
4449

45-
1. Create a new file named *app.py* in the *QuoteOfTheDay* folder. You use the `DefaultAzureCredential` to authenticate to your App Configuration store. Follow the [instructions](./concept-enable-rbac.md#authentication-with-token-credentials) to assign your credential the **App Configuration Data Reader** role. Be sure to allow sufficient time for the permission to propagate before running your application.
50+
1. Create a new file named *app.py* in the *QuoteOfTheDay* folder.
51+
52+
You use the `DefaultAzureCredential` to authenticate to your App Configuration store. Follow the [instructions](./concept-enable-rbac.md#authentication-with-token-credentials) to assign your credential the **App Configuration Data Reader** role. Be sure to allow sufficient time for the permission to propagate before running your application.
4653

4754
```python
4855
import os
@@ -155,12 +162,12 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
155162
]
156163
157164
greeting = feature_manager.get_variant("Greeting", user)
158-
show_greeting = ""
165+
greeting_message = ""
159166
if greeting:
160-
show_greeting = greeting.configuration
167+
greeting_message = greeting.configuration
161168
162169
context["model"] = {}
163-
context["model"]["show_greeting"] = show_greeting
170+
context["model"]["greeting_message"] = greeting_message
164171
context["model"]["quote"] = {}
165172
context["model"]["quote"] = random.choice(quotes)
166173
context["isAuthenticated"] = current_user.is_authenticated
@@ -211,8 +218,8 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
211218
{% block content %}
212219
<div class="quote-container">
213220
<div class="quote-content">
214-
{% if model.show_greeting %}
215-
<h3 class="greeting-content">{{model.show_greeting}}</h3>
221+
{% if model.greeting_message %}
222+
<h3 class="greeting-content">{{model.greeting_message}}</h3>
216223
{% endif %}
217224
<br />
218225
<p class="quote">“{{model.quote.message}}”</p>
@@ -228,25 +235,6 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
228235
<form action="/" method="post">
229236
</form>
230237
</div>
231-
232-
<script>
233-
function heartClicked(button) {
234-
var icon = button.querySelector('i');
235-
icon.classList.toggle('far');
236-
icon.classList.toggle('fas');
237-
238-
// If the quote is hearted
239-
if (icon.classList.contains('fas')) {
240-
// Send a request to the server to save the vote
241-
fetch('/?handler=HeartQuote', {
242-
method: 'POST',
243-
headers: {
244-
'Content-Type': 'application/json',
245-
}
246-
});
247-
}
248-
}
249-
</script>
250238
{% endblock %}
251239
```
252240
@@ -360,9 +348,7 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
360348
{% endblock %}
361349
```
362350
363-
1. Create a new folder named *static* in the *QuoteOfTheDay* folder.
364-
365-
1. Create a new file named *site.css* in the *static* folder.
351+
1. Create a new folder named *static* in the *QuoteOfTheDay* folder and add a new file named *site.css* in it..
366352
367353
```css
368354
html {
@@ -461,19 +447,19 @@ In this tutorial, you use a variant feature flag to manage experiences for diffe
461447
If you use the Windows command prompt, run the following command and restart the command prompt to allow the change to take effect:
462448
463449
```cmd
464-
setx AzureAppConfigurationEndpoint "endpoint-of-your-app-configuration-store"
450+
setx AzureAppConfigurationEndpoint "<endpoint-of-your-app-configuration-store>"
465451
```
466452
467453
If you use PowerShell, run the following command:
468454
469455
```powershell
470-
$Env:AzureAppConfigurationEndpoint = "endpoint-of-your-app-configuration-store"
456+
$Env:AzureAppConfigurationEndpoint = "<endpoint-of-your-app-configuration-store>"
471457
```
472458
473459
If you use macOS or Linux, run the following command:
474460
475461
```bash
476-
export AzureAppConfigurationEndpoint='endpoint-of-your-app-configuration-store'
462+
export AzureAppConfigurationEndpoint='<endpoint-of-your-app-configuration-store'
477463
```
478464
479465
1. In the command prompt, in the *QuoteOfTheDay* folder, run: `flask run`.

articles/azure-app-configuration/index.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ landingContent:
165165
- text: Use variant feature flags
166166
url: howto-variant-feature-flags.md
167167
- text: Use variant feature flags in Python
168-
url: how-to-variant-feature-flags-python.md
168+
url: howto-variant-feature-flags-python.md
169169
- linkListType: reference
170170
links:
171171
- text: .NET feature management

0 commit comments

Comments
 (0)