turfrun/app.py

44 lines
967 B
Python
Raw Permalink Normal View History

2025-04-08 21:26:33 -06:00
import flask
2025-05-06 21:10:16 -06:00
from flask import Flask, render_template, session
from flask_pymongo import Pymongo
2025-04-08 21:26:33 -06:00
import stravalib
2025-05-06 21:10:16 -06:00
import gpxpy
import gpxpy.gpx
from dotenv import load_dotenv
from os import getenv
load_dotenv()
2025-04-08 21:26:33 -06:00
client = stravalib.client.Client()
2025-05-06 21:10:16 -06:00
app = Flask(__name__)
app.config["MONGO_URI"] = f"{getenv("MONGO_URI")}turfrun?authSource=admin"
app.secret_key = getenv("SECRET_KEY")
mongo = Motor(app)
Session(app)
@app.route("/")
def home():
return render_template("index.html")\
@app.route("/api/turf", methods=["GET"])
def get_turf():
turf = mongo.db.turf.find_one()
print(turf)
return render_template("test.html", x=45.6770, y=-111.0429, x2=45.6646, y2=-110.5572, x3=45.2703, y3=-111.3028)
@app.route("/login", methods=["GET", "POST"])
def login():
return render_template("index.html")
@app.route("/logout", methods=["GET", "POST"])
def logout():
return render_template("index.html")
2025-04-08 21:26:33 -06:00
2025-05-06 21:10:16 -06:00
app.run(host="0.0.0.0")