new file: .gitignore new file: Dockerfile new file: README.md new file: app.py new file: app/__init__.py new file: app/game.py new file: app/models.py new file: app/routes.py new file: app/seed.py new file: data/movies.json new file: docker-compose.yml new file: requirements.txt new file: static/css/style.css new file: static/js/game.js new file: static/js/player.js new file: templates/index.html
40 lines
1.1 KiB
Python
40 lines
1.1 KiB
Python
import os
|
|
|
|
from flask import Flask
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
|
|
db = SQLAlchemy()
|
|
|
|
|
|
def create_app():
|
|
app = Flask(__name__)
|
|
|
|
# Konfiguration aus Umgebungsvariablen (Coolify)
|
|
app.config["SECRET_KEY"] = os.environ.get("SECRET_KEY", "dev-secret-key")
|
|
app.config["MAX_ATTEMPTS"] = int(os.environ.get("MAX_ATTEMPTS", "10"))
|
|
app.config["DAILY_RESET_UTC"] = int(os.environ.get("DAILY_RESET_UTC", "9"))
|
|
|
|
db_host = os.environ.get("DB_HOST", "localhost")
|
|
db_port = os.environ.get("DB_PORT", "5432")
|
|
db_user = os.environ.get("DB_USER", "filmdle")
|
|
db_password = os.environ.get("DB_PASSWORD", "")
|
|
db_name = os.environ.get("DB_DATABASE", "filmdle")
|
|
|
|
app.config["SQLALCHEMY_DATABASE_URI"] = (
|
|
f"postgresql://{db_user}:{db_password}@{db_host}:{db_port}/{db_name}"
|
|
)
|
|
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
|
|
|
db.init_app(app)
|
|
|
|
from . import routes # noqa: F401
|
|
|
|
with app.app_context():
|
|
db.create_all()
|
|
# Seed (idempotent) beim Start, damit die App sofort funktioniert
|
|
from .seed import seed_all
|
|
|
|
seed_all()
|
|
|
|
return app
|