{% extends "base_templates/page_base.html" %} {# base_templates/page_base.html extends base_templates/base.html #} {% block main %}
This page is accessible to any user.
{% if not current_user.is_authenticated %}To view the Member page, you must Sign in or Register.
{% endif %}The code:
# The Home page is accessible to anyone
@app.route('/')
def home_page():
return render_template('pages/home_page.html')
# The Member page is accessible to authenticated users (users that have logged in)
@app.route('/member')
@login_required # Limits access to authenticated users
def member_page():
return render_template('pages/member_page.html')
# The Admin page is accessible to users with the 'admin' role
@app.route('/admin')
@roles_required('admin') # Limits access to users with the 'admin' role
def admin_page():
return render_template('pages/admin_page.html')
{% endblock %}