<li {% if request.path == '/' %}class="active"{% endif %}>
<a href="/">Главная</a>
</li>
<ul class="nav navbar-nav navbar-right">
<li {{ home_active }}><a href="/">Home</a></li>
<li {{ places_active }}><a href="/places">Places</a></li>
</ul>
@app.route('/')
@app.route('/home')
def index():
return render_template('index.html', home_active="class=active")
@app.route('/places')
def map():
return render_template('places.html', places_active="class=active")
def some_view():
return render_template('template.html', active='home')
<li class="{% if active=='home' %}active{%endif %}">Home</li>
<li class="{% if active=='blog' %}active{%endif %}">Blog</li>
{% extends "layout.html" %}
{% set active_page = "index" %}
{% set navigation_bar = [
('/', 'index', 'Index'),
('/downloads/', 'downloads', 'Downloads'),
('/about/', 'about', 'About')
] -%}
{% set active_page = active_page|default('index') -%}
...
<ul id="navigation">
{% for href, id, caption in navigation_bar %}
<li{% if id == active_page %} class="active"{% endif
%}><a href="{{ href|e }}">{{ caption|e }}</a></li>
{% endfor %}
</ul>