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 %}}

Blueprint: {name}

Here's your new blueprint.

Located here: {root}

Remember to double-check the config.toml file.

{{% endblock %}} """ # Format to: name, quart_imp_logo, index_html, extends_main_html, index_py, init_py ia_templates_index_html = """\ {{% extends 'www/extends/main.html' %}} {{% block content %}}

Blueprint: {name}

This is the index route of the included example blueprint.

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.

{{% endblock %}} """ # Format to: head_tag templates_extends_main_html = """\ {head_tag} {{% include '{name}/includes/header.html' %}} {{% block content %}}{{% endblock %}} {{% include '{name}/includes/footer.html' %}} """ # Format to: header_html, main_html templates_includes_header_html = """\
quart-imp logo

Quart-Imp

This is the header, located here: {header_html}

It's being imported in the {main_html} template.

""" # Format to: footer_html, main_html templates_includes_footer_html = """\

This is the footer, located here: {footer_html}

It's being imported in the {main_html} template.

"""