This commit is contained in:
Mateusz Gruszczyński
2026-02-26 14:13:04 +01:00
commit b6f96085a1
15 changed files with 730 additions and 0 deletions

34
app/__init__.py Normal file
View File

@@ -0,0 +1,34 @@
from flask import Flask, request, render_template
from .config import Config
from .api import api_bp
def create_app():
app = Flask(__name__)
app.config.from_object(Config)
app.register_blueprint(api_bp, url_prefix='/api')
@app.route('/favicon.ico')
def favicon():
return '', 204
@app.after_request
def add_cache_headers(response):
if request.path.startswith('/static/'):
max_age = app.config['STATIC_CACHE_MAX_AGE']
response.headers['Cache-Control'] = f'public, max-age={max_age}'
return response
@app.route('/')
def index():
template_vars = {
'APP_TITLE': app.config['APP_TITLE'],
'APP_FOOTER': app.config['APP_FOOTER']
}
return render_template('main.html', config=template_vars)
@app.route('/api/health')
def health():
return {'status': 'OK'}
return app