fix: update boilerplates to better reflect how apps get generated

This commit is contained in:
Radek Goláň jr. 2025-08-09 14:56:04 +02:00
parent cb99c1a99e
commit dde0fc8962
Signed by: shield
GPG Key ID: D86423BFC31F3591
3 changed files with 16 additions and 4 deletions

View File

@ -4,3 +4,12 @@ from quart_imp import Imp
imp = Imp()
"""
def extensions_sql() -> str:
return """\
from quart import Quart
def register_module(app:Quart):
pass
"""

View File

@ -1,8 +1,10 @@
def init_full_py(app_name: str, secret_key: str) -> str:
return f"""\
from quart import Quart
from quart_imp.config import QuartConfig, ImpConfig
from {app_name}.extensions import imp
from {app_name}.extensions.sql import db
def create_app():
@ -23,9 +25,6 @@ def create_app():
db.init_app(app)
with app.app_context():
db.create_all()
return app
"""

View File

@ -67,7 +67,7 @@ def minimal_app(app_folder: Path) -> None:
def slim_app(app_folder: Path) -> None:
from .filelib.init import init_slim_py
from .filelib.extensions import extensions_init
from .filelib.extensions import extensions_init, extensions_sql
from .filelib.resources import resources_cli_py
from .filelib.resources import resources_error_handlers_py
from .filelib.templates import templates_error_html
@ -161,6 +161,10 @@ def full_app(app_folder: Path) -> None:
folders["extensions"] / "__init__.py",
extensions_init(),
),
"extensions/sql.py": (
folders["extensions"] / "sql.py",
extensions_sql(),
),
"resources/cli/cli.py": (
folders["resources/cli"] / "cli.py",
resources_cli_py(),