new file: .env.example
new file: .gitignore new file: Dockerfile new file: README.md new file: app.py new file: auth.py new file: config.py new file: db.py new file: db_helpers.py new file: docker-compose.yml new file: requirements.txt new file: routes/__init__.py new file: routes/admin_routes.py new file: routes/auth_routes.py new file: routes/journal_routes.py new file: static/css/style.css new file: static/js/main.js new file: templates/admin/dashboard.html new file: templates/admin/users.html new file: templates/base.html new file: templates/day.html new file: templates/future.html new file: templates/index.html new file: templates/login.html new file: templates/week.html
This commit is contained in:
46
app.py
Normal file
46
app.py
Normal file
@@ -0,0 +1,46 @@
|
||||
"""Einstiegspunkt der Flask-App. Registriert alle Blueprints."""
|
||||
from datetime import date, datetime
|
||||
|
||||
from flask import Flask
|
||||
|
||||
from config import Config
|
||||
from db import init_db
|
||||
|
||||
|
||||
def create_app(config_class=Config):
|
||||
app = Flask(__name__)
|
||||
app.config.from_object(config_class)
|
||||
|
||||
# Blueprints registrieren
|
||||
from routes.auth_routes import auth_bp
|
||||
from routes.journal_routes import journal_bp
|
||||
from routes.admin_routes import admin_bp
|
||||
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(journal_bp)
|
||||
app.register_blueprint(admin_bp)
|
||||
|
||||
# Template/Filter-Helfer in Kontext verfügbar machen
|
||||
@app.context_processor
|
||||
def inject_globals():
|
||||
today = date.today()
|
||||
return {
|
||||
"now": datetime.now(),
|
||||
"today_str": today.strftime("%Y-%m-%d"),
|
||||
}
|
||||
|
||||
# Schema anlegen + Bootstrap-Admin beim ersten Start
|
||||
with app.app_context():
|
||||
from db import get_connection
|
||||
from db_helpers import ensure_admin
|
||||
init_db()
|
||||
ensure_admin(app)
|
||||
|
||||
return app
|
||||
|
||||
|
||||
app = create_app()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=8000, debug=False)
|
||||
Reference in New Issue
Block a user