You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
661 B
29 lines
661 B
# -*- 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
|
|
|