1from flask_login import current_user
2
3@app.route(...)
4def your_route():
5 return current_user.is_authenticated
1from __future__ import print_function # In python 2.7
2import sys
3
4@app.route('/button/')
5def button_clicked():
6 print('Hello world!', file=sys.stderr)
7 return redirect('/')
1<p><i class="fa fa-fw fa-calendar"></i>Create account at {{ user.create_account.strftime('%Y-%m-%d') }}</p>
1<!doctype html>
2<title>{% block title %}{% endblock %} - Flaskr</title>
3<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
4<nav>
5 <h1>Flaskr</h1>
6 <ul>
7 {% if g.user %}
8 <li><span>{{ g.user['username'] }}</span>
9 <li><a href="{{ url_for('auth.logout') }}">Log Out</a>
10 {% else %}
11 <li><a href="{{ url_for('auth.register') }}">Register</a>
12 <li><a href="{{ url_for('auth.login') }}">Log In</a>
13 {% endif %}
14 </ul>
15</nav>
16<section class="content">
17 <header>
18 {% block header %}{% endblock %}
19 </header>
20 {% for message in get_flashed_messages() %}
21 <div class="flash">{{ message }}</div>
22 {% endfor %}
23 {% block content %}{% endblock %}
24</section>
25