modified: app/__init__.py
This commit is contained in:
@@ -5,9 +5,17 @@ from flask_sqlalchemy import SQLAlchemy
|
||||
|
||||
db = SQLAlchemy()
|
||||
|
||||
# Die Templates/Static-Verzeichnisse liegen auf Repo-Ebene (neben dem app/ Paket),
|
||||
# nicht innerhalb des Pakets. Daher relativ zur Repo-Wurzel (Ueberverzeichnis) aufloesen.
|
||||
_REPO_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
def create_app():
|
||||
app = Flask(__name__)
|
||||
app = Flask(
|
||||
__name__,
|
||||
template_folder=os.path.join(_REPO_ROOT, "templates"),
|
||||
static_folder=os.path.join(_REPO_ROOT, "static"),
|
||||
)
|
||||
|
||||
# Konfiguration aus Umgebungsvariablen (Coolify)
|
||||
app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "dev-secret-key")
|
||||
@@ -29,6 +37,8 @@ def create_app():
|
||||
|
||||
from . import routes # noqa: F401
|
||||
|
||||
app.register_blueprint(routes.bp)
|
||||
|
||||
with app.app_context():
|
||||
db.create_all()
|
||||
# Seed (idempotent) beim Start, damit die App sofort funktioniert
|
||||
|
||||
Reference in New Issue
Block a user