slinky/main.py

27 lines
602 B
Python
Raw Normal View History

2021-12-20 15:09:30 +00:00
"""
Main Flask-based app for Slinky
"""
2022-01-22 12:32:34 +00:00
from flask import Flask, Response, render_template
from flask_bootstrap import Bootstrap # type: ignore[import]
from werkzeug.middleware.proxy_fix import ProxyFix
2021-12-19 11:48:42 +00:00
2021-12-28 15:15:08 +00:00
from slinky.web import protect, slinky_webapp
2021-12-19 11:48:42 +00:00
2021-12-20 15:09:30 +00:00
app = Flask(__name__)
app.wsgi_app = ProxyFix(app.wsgi_app, x_proto=1) # type: ignore[assignment]
2021-12-20 15:09:30 +00:00
app.register_blueprint(slinky_webapp)
2021-12-19 11:48:42 +00:00
2021-12-20 15:09:30 +00:00
Bootstrap(app)
2021-12-19 11:48:42 +00:00
2021-12-20 15:09:30 +00:00
@app.route('/')
2021-12-28 15:15:08 +00:00
@protect
2022-01-22 12:32:34 +00:00
def index() -> Response:
2021-12-20 15:09:30 +00:00
"""
Index/Landing page
2021-12-19 11:48:42 +00:00
2021-12-20 15:09:30 +00:00
Returns:
str: string of page content
"""
2022-01-22 12:32:34 +00:00
return Response(render_template('index.html'), 200)