orochi-discord/orochi/http.py

28 lines
664 B
Python
Raw Normal View History

from threading import Thread
from flask import Flask, render_template
2021-11-13 14:54:59 +00:00
from orochi.config import Config
from orochi.models import Game
app = Flask(__name__)
@app.route('/')
def index():
game = Game.INSTANCE
return render_template('list.html', game=game)
@app.route('/admin')
def admin():
game = Game.INSTANCE
return render_template('list.html', game=game, admin=True)
2021-11-13 14:54:59 +00:00
def run_web_server(config: Config):
Thread(target=lambda: app.run(host=config.http_host,
port=config.http_port,
debug=config.http_debug,
use_reloader=False)).start()