-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplication.py
More file actions
31 lines (22 loc) · 1002 Bytes
/
application.py
File metadata and controls
31 lines (22 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
from flask import Flask, render_template, session, request, redirect, url_for, jsonify , make_response
from flask_session import Session
import time
import requests
from utilities import *
app = Flask(__name__, static_folder = "images")
app.config["SESSION_PERMANENT"] = False
app.config["SESSION_TYPE"] = "filesystem"
Session(app)
app.config["SECRET_KEY"] = os.getenv("SECRET_KEY")
@app.route("/", methods=["GET", "POST"])
def index():
if request.method == "POST":
coordinate = request.form.get("coordinates")
if coordinate == None:
return render_template("index.html", message = "Something went wrong")
coordinate = coordinate.split(",")
coordinate = [float(coordinate[0].strip()), float(coordinate[1].strip())]
year, name = coordinates(coordinate[0], coordinate[1])
return render_template("index.html", message = year , path = name)
return render_template("index.html", message = "XX", path = "images/base.png")