b3e3757a92
Made-with: Cursor
30 lines
661 B
Python
30 lines
661 B
Python
# -*- coding: utf-8 -*-
|
|
import os
|
|
import secrets
|
|
|
|
from flask import Flask, jsonify
|
|
|
|
|
|
def create_app() -> Flask:
|
|
app = Flask(
|
|
__name__,
|
|
instance_relative_config=True,
|
|
template_folder='templates',
|
|
static_folder='static',
|
|
static_url_path='/static',
|
|
)
|
|
sk = (os.environ.get('SECRET_KEY') or '').strip()
|
|
app.config['SECRET_KEY'] = sk or secrets.token_hex(32)
|
|
|
|
@app.route('/health')
|
|
def health():
|
|
return jsonify(status='ok', service='testing-flask-app')
|
|
|
|
@app.route('/')
|
|
def index():
|
|
from flask import render_template
|
|
|
|
return render_template('index.html')
|
|
|
|
return app
|