Flask Snippets

Admin Blueprint

A common need of a website is to have an admin interface that is only accessible to a subset of users (ex. users with an admin role). Putting this code in the same modules (files) as the rest of the site can clutter things quickly.

Here is some boilerplate that leverages the power of Blueprints
to separate the admin views/forms/etc from the rest of the site, as well as conveniently handle the need to restrict all requests to admin views.