Skip to main content

Flask blueprints auto discovery

Project description

Blueprints

Blueprints is a library to perform auto-discovery of Flask blueprints by scanning the installed packages for blueprints.txt files.

Discovery

Discovery of blueprints is performed by the register_blueprints method. All discovered blueprints are stored in a blueprints attribute of the blueprints package. The attribute is a dictionary containing the blueprint name and associated meta data.

If a blueprint has the url_prefix specified then it is used. Otherwise, the package name containing the blueprint is used as the url_prefix.

Running

Blueprints can be run as a module.

python -m blueprints

If waitress is installed then a server using waitress is started. If waitress is not installed then the flask development server is started.

Embedding

Blueprints can be embedded in an existing program very simply.

from flask import Flask
from blueprints import register_blueprints
app = Flask(__name__)
register_blueprints('blueprints.txt', app)
app.run()

blueprints.txt format

The blueprints.txt file is a multi-line file containing one line per blueprint to import. The structure of the line is ...

hello.entry.bp  => imports hello.entry and retrieves the bp attribute containing a flask blueprint

License

MIT Licensed

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

auto_blueprints-0.1.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

auto_blueprints-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file auto_blueprints-0.1.0.tar.gz.

File metadata

  • Download URL: auto_blueprints-0.1.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for auto_blueprints-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9fc2abbf1fd9440088a123c9d4bc3f2e6987c27e73cf7e1de21bf1933a84b13c
MD5 c9fd92c26e9818a857490460d9f96a84
BLAKE2b-256 78fc96c92f5a49c87fc812e2753a49b03f564ad6d79d1cb98dd5e45b53ecc3ff

See more details on using hashes here.

File details

Details for the file auto_blueprints-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for auto_blueprints-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a5d40d114742a3e61eb45f7f867d94ea01e554ccaa21761ebf76ebdd732f8968
MD5 c33df354e0a9ceb2558c0ff7ab7a4bd6
BLAKE2b-256 210611a382f771f359b5ef778ecdbebc2a707b9d5a09080fdb135a9ee6b6a09b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page