Region-Tagging Your App: Letting App Service Tell You Where It's Running
App Service auto-injects REGION_NAME. With three lines of Python your DR app proudly displays "Korea Central" during failover, no manual config.
Here's a small but high-value pattern: surface the running region in the UI footer. During a Front Door failover drill, you can see in the browser that you're now hitting Korea, not Sweden.
The three-line implementation
APP_REGION = (
os.getenv("APP_REGION") # explicit override
or os.getenv("REGION_NAME") # App Service auto-injects this
or "local"
)
App Service automatically sets REGION_NAME to the friendly region
string (e.g. Sweden Central). You don't have to configure it. It
Just Works on every App Service in every region.
Show it in the UI
Pass app_region through a Flask context processor; render it in
your base layout footer:
<span class="region-badge">
<span class="region-dot"></span>Region: {{ app_region }}
</span>
Add a green pulsing dot via CSS keyframes (and respect
prefers-reduced-motion — accessibility matters even on a portfolio
site).
The payoff is bigger than it looks. During a drill, instead of trusting
abstract dashboards, you and your team watch the badge flip from
swedencentral to koreacentral. Visible failover builds
confidence — and confidence is what DR programs actually deliver.