K+12 Education

Topics: Computer program, Reproduction, Object-oriented programming Pages: 2 (410 words) Published: February 14, 2013
Applications with Blueprints
Flask uses a concept of blueprints for making application components and supporting common patterns within an application or across applications. Blueprints can greatly simplify how large applications work and provide a central means for Flask extensions to register operations on applications. A Blueprint object works similarly to a Flaskapplication object, but it is not actually an application. Rather it is a blueprint of how to construct or extend an application. Why Blueprints?

Blueprints in Flask are intended for these cases:
* Factor an application into a set of blueprints. This is ideal for larger applications; a project could instantiate an application object, initialize several extensions, and register a collection of blueprints. * Register a blueprint on an application at a URL prefix and/or subdomain. Parameters in the URL prefix/subdomain become common view arguments (with defaults) across all view functions in the blueprint. * Register a blueprint multiple times on an application with different URL rules. * Provide template filters, static files, templates, and other utilities through blueprints. A blueprint does not have to implement applications or view functions. * Register a blueprint on an application for any of these cases when initializing a Flask extension. A blueprint in Flask is not a pluggable app because it is not actually an application – it’s a set of operations which can be registered on an application, even multiple times. Why not have multiple application objects? You can do that (see Application Dispatching), but your applications will have separate configs and will be managed at the WSGI layer. Blueprints instead provide separation at the Flask level, share application config, and can change an application object as necessary with being registered. The downside is that you cannot unregister a blueprint once an application was created without having to destroy the whole application...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • K +12 Education Essay
  • K-12 Education Essay
  • Essay about K+12 Education
  • K-12 Education Essay
  • Essay about Does K-12 Education the Solution?
  • K 12 Lesson Plan Sample Essay
  • Essay about k-12
  • K-12 Essay

Become a StudyMode Member

Sign Up - It's Free