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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9fc2abbf1fd9440088a123c9d4bc3f2e6987c27e73cf7e1de21bf1933a84b13c |
|
MD5 | c9fd92c26e9818a857490460d9f96a84 |
|
BLAKE2b-256 | 78fc96c92f5a49c87fc812e2753a49b03f564ad6d79d1cb98dd5e45b53ecc3ff |
File details
Details for the file auto_blueprints-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: auto_blueprints-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5d40d114742a3e61eb45f7f867d94ea01e554ccaa21761ebf76ebdd732f8968 |
|
MD5 | c33df354e0a9ceb2558c0ff7ab7a4bd6 |
|
BLAKE2b-256 | 210611a382f771f359b5ef778ecdbebc2a707b9d5a09080fdb135a9ee6b6a09b |