from dataclasses import dataclass @dataclass(frozen=True) class BlueprintFileLib: # Format to: NONE init_py = """\ from quart_imp import Blueprint bp = Blueprint(__name__) bp.import_resources("routes") @bp.before_app_request async def before_app_request(): bp.init_session() """ # Format to: name, url_prefix config_toml = """\ ENABLED = "yes" [SETTINGS] URL_PREFIX = "/{url_prefix}" #SUBDOMAIN = "" #URL_DEFAULTS = {{}} STATIC_FOLDER = "static" TEMPLATE_FOLDER = "templates" STATIC_URL_PATH = "/static" #ROOT_PATH = "" #CLI_GROUP = "" [SESSION] #{name}_session = "yes" # Set ENABLED to true to allow the blueprint # to create a database bind, change settings accordingly. [DATABASE_BIND] ENABLED = false DIALECT = "sqlite" DATABASE_NAME = "{name}" LOCATION = "" PORT = "" USERNAME = "" PASSWORD = "" """ # Format to: Name routes_index_py = """\ from quart import render_template from .. import bp @bp.route("/", methods=["GET"]) async def index(): return await render_template(bp.tmpl("index.html")) """ # Format to: root, name, quart_imp_logo templates_index_html = """\ {{% extends '{name}/extends/main.html' %}} {{% block content %}}
Located here: {root}
Remember to double-check the config.toml file.
This template page is located in {index_html}
it extends from {extends_main_html}
with its route defined in {index_py}
It's being imported by bp.import_resources("routes")
in the {init_py}
file.
This is the header, located here: {header_html}
It's being imported in the {main_html}
template.
This is the footer, located here: {footer_html}
It's being imported in the {main_html}
template.