Add initial app (just index page)
This commit is contained in:
37
formula10.py
Normal file
37
formula10.py
Normal file
@ -0,0 +1,37 @@
|
||||
from flask import Flask, render_template, request, redirect
|
||||
from flask_sqlalchemy import SQLAlchemy
|
||||
from model import *
|
||||
from database_utils import reload_static_data, export_dynamic_data
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///formula10.db";
|
||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False;
|
||||
|
||||
db.init_app(app)
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
return render_template("index.jinja")
|
||||
|
||||
@app.route("/reload")
|
||||
def reload():
|
||||
reload_static_data(db)
|
||||
return redirect("/")
|
||||
|
||||
# @app.route("/teams", methods=["GET", "POST"])
|
||||
# def teams():
|
||||
# if request.method == "POST":
|
||||
# new_team = Team(
|
||||
# name = request.form["name"],
|
||||
# country_code = request.form["country_code"]
|
||||
# )
|
||||
# print(new_team.name, new_team.country_code)
|
||||
# db.session.add(new_team)
|
||||
# db.session.commit()
|
||||
#
|
||||
# return render_template("teams.jinja", page="teams")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(debug=False)
|
Reference in New Issue
Block a user