0PricingLogin
Flask Academy · Lesson

Create and Register a Blueprint

Define a Blueprint and attach it to the app.

Two Steps to a Blueprint

Working with a blueprint is two moves: first you define it in its own module, then you register it on the app. Let us walk through both.

Import the Blueprint Class

Everything starts with one import. The Blueprint class comes straight from flask, just like the Flask app object does.

from flask import Blueprint

All lessons in this course

  1. Why Blueprints Beat One Giant File
  2. Create and Register a Blueprint
  3. URL Prefixes and Blueprint url_for
  4. Blueprint-Scoped Templates and Statics
← Back to Flask Academy