orochi-discord/orochi/http.py

28 lines
664 B
Python

from threading import Thread
from flask import Flask, render_template
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)
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()