{"id":17767919,"url":"https://github.com/bezborodow/flask-blueprints","last_synced_at":"2026-05-17T01:45:54.888Z","repository":{"id":182789943,"uuid":"669119046","full_name":"bezborodow/flask-blueprints","owner":"bezborodow","description":"Register all Flask Blueprints (including nested) from a package directory.","archived":false,"fork":false,"pushed_at":"2024-03-04T06:44:42.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T08:49:10.957Z","etag":null,"topics":["autoimport","flask","flask-blueprints","importlib"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/flask-blueprints/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bezborodow.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-21T11:41:54.000Z","updated_at":"2024-03-19T06:36:47.000Z","dependencies_parsed_at":"2024-10-26T21:17:09.974Z","dependency_job_id":"787cfd5c-5c1c-4cf3-912a-c4652c6361a5","html_url":"https://github.com/bezborodow/flask-blueprints","commit_stats":null,"previous_names":["bezborodow/flask-register-blueprints","bezborodow/flask-blueprints"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-blueprints","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-blueprints/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-blueprints/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bezborodow%2Fflask-blueprints/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bezborodow","download_url":"https://codeload.github.com/bezborodow/flask-blueprints/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246651563,"owners_count":20811994,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autoimport","flask","flask-blueprints","importlib"],"created_at":"2024-10-26T20:52:04.173Z","updated_at":"2026-05-17T01:45:49.852Z","avatar_url":"https://github.com/bezborodow.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask Blueprint Autoimporter\n\n**`flask-blueprints`** will import and register all nested Flask Blueprints under a given package directory.\n\n## Synopsis\n\nRegister all Flask Blueprints (including nested) from a package directory.\n\n## Usage\n\nCreate an empty package `app.blueprints` and register your blueprints:\n\n```python\nfrom flask import Flask\nfrom flask_blueprints import register_blueprints\n\n\napp = Flask(__name__)\nregister_blueprints(app, 'app.blueprints')\n```\n\nBlueprints can now be placed under this package, as such:\n\n```\n.\n└── app\n    ├── blueprints\n    │   ├── account\n    │   │   ├── account.py\n    │   │   ├── contact\n    │   │   │   ├── contact.py\n    │   │   │   └── __init__.py\n    │   │   └── __init__.py\n    │   ├── api\n    │   │   ├── account\n    │   │   │   ├── account.py\n    │   │   │   ├── contact\n    │   │   │   │   ├── contact.py\n    │   │   │   │   └── __init__.py\n    │   │   │   └── __init__.py\n    │   │   ├── __init__.py\n    │   │   └── user\n    │   │       ├── __init__.py\n    │   │       └── tribute.py\n    │   ├── __init__.py\n    │   └── project\n    │       ├── documents.py\n    │       ├── __init__.py\n    │       ├── project.py\n    │       └── search.py\n    └── __init__.py\n```\n\n\nBlueprint `__init__.py` files should look something like the following:\n\n```python\nfrom flask import Blueprint\n\n\nbp = Blueprint('project', __name__)\nfrom . import documents\nfrom . import project\nfrom . import search\n```\n\n(Note that the top-level `app/blueprints/__init__.py` is not a blueprint\npackage, and therefore should not have a blueprint defined.)\n\nThe blueprint files themselves can then define the routes. For example:\n\n```python\nfrom flask import redirect, url_for\nfrom . import bp\n\n@bp.post('/project/\u003cint:project_id\u003e/store')\ndef store(project_id):\n\t# ...\n\treturn redirect(url_for('project.show', project_id=project_id))\n```\n\nIf the blueprint variable is not `bp`, then this can be customised:\n\n```python\nregister_blueprints(app, 'app.blueprints', bp='bp')\n```\n\n\n## Further Reading\n\n * [`importlib` — The implementation of `import`](https://docs.python.org/3/library/importlib.html)\n * [`pkgutil` — Package extension utility](https://docs.python.org/3/library/pkgutil.html)\n * [Modular Applications with Blueprints](https://flask.palletsprojects.com/en/2.3.x/blueprints/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezborodow%2Fflask-blueprints","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbezborodow%2Fflask-blueprints","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbezborodow%2Fflask-blueprints/lists"}