osu-wayback/web.py

34 lines
722 B
Python
Raw Normal View History

2018-01-12 23:16:10 +01:00
import json
import MySQLdb
import MySQLdb.cursors
2018-01-13 21:39:01 +01:00
from flask import Flask, make_response, request, render_template, jsonify
2018-05-23 22:59:21 +02:00
from handlers import update
2018-01-12 23:16:10 +01:00
app = Flask(__name__)
with open("config.json", "r") as f:
2018-05-23 22:59:21 +02:00
config = json.load(f)
2018-01-12 23:16:10 +01:00
@app.route("/")
2018-01-13 21:39:01 +01:00
@app.route("/home")
2018-01-12 23:16:10 +01:00
def home_index():
2018-05-23 22:59:21 +02:00
return render_template("index.html")
2018-01-12 23:16:10 +01:00
2018-01-13 21:39:01 +01:00
@app.route("/download")
def download_index():
2018-05-23 22:59:21 +02:00
return render_template("download.html")
@app.route("/api")
def api_index():
return render_template("api.html")
@app.route("/api/getUpdate", methods=["GET", "POST"])
def api_update():
return update.handle(request)
2018-01-13 21:39:01 +01:00
2018-05-15 10:25:04 +02:00
@app.route("/api")
def api_index():
return render_template("api.html")
2018-01-12 23:16:10 +01:00
if __name__ == "__main__":
2018-05-23 22:59:21 +02:00
app.run(**config["web"])