2024-08-16 15:08:51 +01:00
|
|
|
def init_full_py(app_name: str, secret_key: str) -> str:
|
|
|
|
return f"""\
|
|
|
|
from quart import Quart
|
2025-08-09 14:56:04 +02:00
|
|
|
from quart_imp.config import QuartConfig, ImpConfig
|
2024-08-16 15:08:51 +01:00
|
|
|
|
2025-08-09 15:00:50 +02:00
|
|
|
from {app_name}.extensions import imp, sql
|
2024-08-16 15:08:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
def create_app():
|
|
|
|
app = Quart(__name__, static_url_path="/")
|
|
|
|
|
2025-08-09 15:00:50 +02:00
|
|
|
cfg = QuartConfig(
|
2024-08-16 15:08:51 +01:00
|
|
|
secret_key="{secret_key}",
|
|
|
|
app_instance=app
|
|
|
|
)
|
2025-08-09 15:00:50 +02:00
|
|
|
cfg.init_app(app)
|
2024-08-16 15:08:51 +01:00
|
|
|
|
|
|
|
imp.init_app(app, ImpConfig(
|
|
|
|
init_session={{"logged_in": False}},
|
|
|
|
))
|
|
|
|
|
2025-08-09 17:56:26 +02:00
|
|
|
imp.import_extensions("extensions")
|
2024-08-16 15:08:51 +01:00
|
|
|
imp.import_app_resources()
|
|
|
|
imp.import_blueprints("blueprints")
|
|
|
|
imp.import_models("models")
|
|
|
|
|
|
|
|
return app
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def init_slim_py(app_name: str, secret_key: str) -> str:
|
|
|
|
return f"""\
|
|
|
|
from quart import Quart
|
|
|
|
|
|
|
|
from {app_name}.extensions import imp
|
|
|
|
from quart_imp.config import ImpConfig, QuartConfig
|
|
|
|
|
|
|
|
|
|
|
|
def create_app():
|
|
|
|
app = Quart(__name__, static_url_path="/")
|
|
|
|
|
|
|
|
QuartConfig(
|
|
|
|
secret_key="{secret_key}",
|
|
|
|
app_instance=app
|
|
|
|
)
|
|
|
|
|
2025-08-09 17:56:26 +02:00
|
|
|
imp.import_extensions("extensions")
|
2024-08-16 15:08:51 +01:00
|
|
|
imp.init_app(app, ImpConfig())
|
|
|
|
imp.import_app_resources()
|
|
|
|
imp.import_blueprint("www")
|
|
|
|
|
|
|
|
return app
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
def init_minimal_py(secret_key: str) -> str:
|
|
|
|
return f"""\
|
|
|
|
from quart import Quart
|
|
|
|
|
|
|
|
from quart_imp import Imp
|
|
|
|
from quart_imp.config import ImpConfig, QuartConfig
|
|
|
|
|
|
|
|
|
|
|
|
def create_app():
|
|
|
|
app = Quart(__name__, static_url_path="/")
|
|
|
|
|
|
|
|
QuartConfig(
|
|
|
|
secret_key="{secret_key}",
|
|
|
|
app_instance=app
|
|
|
|
)
|
|
|
|
|
|
|
|
imp = Imp(app, ImpConfig())
|
|
|
|
imp.import_app_resources()
|
|
|
|
|
|
|
|
return app
|
|
|
|
"""
|