{"id":14065257,"url":"https://github.com/aiscenblue/flask-blueprint","last_synced_at":"2025-07-12T07:31:24.770Z","repository":{"id":57430167,"uuid":"108532262","full_name":"aiscenblue/flask-blueprint","owner":"aiscenblue","description":"blueprint maker for flask application","archived":false,"fork":false,"pushed_at":"2019-10-14T12:38:58.000Z","size":43,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-29T08:39:18.623Z","etag":null,"topics":["blueprint","flask","flask-blueprints","python","python2","python3"],"latest_commit_sha":null,"homepage":"https://pypi.python.org/pypi/flask-blueprint","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aiscenblue.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}},"created_at":"2017-10-27T10:22:26.000Z","updated_at":"2023-06-09T19:34:29.000Z","dependencies_parsed_at":"2022-08-26T04:43:17.286Z","dependency_job_id":null,"html_url":"https://github.com/aiscenblue/flask-blueprint","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/aiscenblue/flask-blueprint","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fflask-blueprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fflask-blueprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fflask-blueprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fflask-blueprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aiscenblue","download_url":"https://codeload.github.com/aiscenblue/flask-blueprint/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aiscenblue%2Fflask-blueprint/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264958135,"owners_count":23689006,"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":["blueprint","flask","flask-blueprints","python","python2","python3"],"created_at":"2024-08-13T07:04:23.586Z","updated_at":"2025-07-12T07:31:24.493Z","avatar_url":"https://github.com/aiscenblue.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Flask Blueprint\nBetter way to create blueprint\n\n[![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://github.com/aiscenblue/flask-blueprint)\n[![PyPI version](https://badge.fury.io/py/flask-app-core.svg)](https://github.com/aiscenblue/flask-blueprint)\n[![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/aiscenblue/flask-blueprint/blob/master/LICENSE)\n\n# Requirements:\n```\n  Python 2.7 or higher\n```\n\n# PIP installation\n\n`pip install flask-blueprint`\n\n# Easy Installation\n\n```\n    from flask_blueprint import Blueprint\n    from flask import Flask\n    \n    flask_app = Flask(import_name, instance_relative_config=True)\n    Blueprint(app=flask_app, root_path=['path/to/module'])\n    flask_app.run()\n```\n\n\u003e view on pypi\n\n\u003e https://pypi.python.org/pypi/flask-blueprint\n\n# Simple Routing\n```\ncreate a /modules directory\ncreate index.py under modules directory\npaste the code below to create initial route\n```\n\n    from flask import Blueprint, make_response, render_template\n\n    \"\"\" blueprint module for url handler \"\"\"\n    __method__ = Blueprint(__name__, __name__)\n    app = __method__\n    \n    \n    @app.route(\"/\", methods=['GET'])\n    def index():\n        return make_response(\"Welcome to flask starter kit API!\", 200)\n\n# Class routing\n\n\n` create a folder Home where you point your module directory`\n\n```\n~/module-directory/\n  /__init__.py\n  /index.py \n```\n`Your index.py will be your initial route.`\n\n`FOR MORE EXAMPLE SEE: `[Flask Starter kit](https://github.com/aiscenblue/flask-starter-kit)\n\n`NOTE:: __init__.py must be ALWAYS included in the folder in order to detect the model folder as a module`\n\n#### methods.py\n\n```\nfrom flask import make_response\n\n\nclass Methods:\n\n    @staticmethod\n    def index():\n        return make_response(\"Welcome module\", 200)\n\n    @staticmethod\n    def create():\n        return make_response(\"Welcome POST method\", 200)\n\n    @staticmethod\n    def update():\n        return make_response(\"Welcome PUT method\", 200)\n\n    @staticmethod\n    def destroy():\n        return make_response(\"Welcome DELETE method\", 200)\n\n```\n\n#### routing.py\n\n```\nfrom flask import Blueprint\nfrom module.welcome.methods import Methods\n\n\"\"\" blueprint module for url handler \"\"\"\n__method__ = Blueprint(__name__, __name__)\n\n\"\"\" \n    ROUTES:\n        routing for base directory module\n        name, slug, function, methods\n\"\"\"\n__routes__ = [\n    (\"welcome\", \"/\", Methods)\n]\n\n```\n\n# Variable Rules\n`http://flask.pocoo.org/docs/0.12/quickstart/#variable-rules`\n```\n__routes__ = [\n    (\"posts\", \"/\u003cint:post_id\u003e\", Methods)\n]\n```\n\n```\nfrom flask import make_response\n\n\nclass Methods:\n\n    @staticmethod\n    def index(post_id=None):\n        return make_response(\"get post ID: {}\".format(post_id), 200)\n\n    @staticmethod\n    def create(name=None):\n        return make_response(\"POST method for post ID: {}\".format(post_id), 200)\n\n    @staticmethod\n    def update(name=None):\n        return make_response(\"PUT method for post ID: {}\".format(post_id), 200)\n\n    @staticmethod\n    def destroy(name=None):\n        return make_response(\"DELETE method for post ID: {}\".format(post_id), 200)\n\n```\n\n# Custom Routing using function\n\n```\nfrom flask import Blueprint\nfrom module.welcome.methods import Methods\n\n\"\"\" blueprint module for url handler \"\"\"\n__method__ = Blueprint(__name__, __name__)\n\n\"\"\" \n    ROUTES:\n        routing for base directory module\n        name, slug, function, methods\n\"\"\"\n__routes__ = [\n    (\"welcome\", \"/\", Methods.my_new_function, ['GET', 'POST', 'PUT', 'DELETE'])\n]\n```\n\n#### you can set a function with single or multiple methods\n\n#### blueprint documentation\n#### http://flask.pocoo.org/docs/0.12/blueprints/#my-first-blueprint\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiscenblue%2Fflask-blueprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faiscenblue%2Fflask-blueprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faiscenblue%2Fflask-blueprint/lists"}