turfrun/app.py
Ian Burgess 02845f8a59 yes
2025-05-06 21:10:16 -06:00

44 lines
967 B
Python

import flask
from flask import Flask, render_template, session
from flask_pymongo import Pymongo
import stravalib
import gpxpy
import gpxpy.gpx
from dotenv import load_dotenv
from os import getenv
load_dotenv()
client = stravalib.client.Client()
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")
app.run(host="0.0.0.0")