Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -53,16 +53,16 @@ global colorsused
|
|
| 53 |
global pdflink
|
| 54 |
# For 2.7
|
| 55 |
global hatched_areas2_7
|
| 56 |
-
|
| 57 |
# Configure Flask-Session for server-side session storage
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
|
| 63 |
# Initialize Flask-Session
|
| 64 |
-
|
| 65 |
-
|
| 66 |
|
| 67 |
@app.route("/", methods=["GET", "POST"])
|
| 68 |
def getInfotoMeasure():
|
|
@@ -76,25 +76,18 @@ def password_page():
|
|
| 76 |
def check_password():
|
| 77 |
password = request.form.get("password")
|
| 78 |
correct_password = "c900"
|
|
|
|
| 79 |
if password == correct_password:
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
return 'Authenticated'
|
| 83 |
else:
|
| 84 |
-
return
|
| 85 |
-
# if password == correct_password:
|
| 86 |
-
# session["authenticated"] = True
|
| 87 |
-
# return jsonify({"authenticated": True}), 200
|
| 88 |
-
# else:
|
| 89 |
-
# return jsonify({"authenticated": False}), 200
|
| 90 |
|
| 91 |
@app.route("/mainGUI", methods=["GET", "POST"])
|
| 92 |
def main_gui():
|
| 93 |
-
if
|
| 94 |
-
return render_template("proposed-GUI.html")
|
| 95 |
-
else:
|
| 96 |
return redirect(url_for("password_page"))
|
| 97 |
-
|
| 98 |
|
| 99 |
|
| 100 |
|
|
@@ -995,10 +988,11 @@ def cvtSummarytoXML(jsdata):
|
|
| 995 |
|
| 996 |
#_________________________________________________________________________________________________________________________
|
| 997 |
#_________________________________________________________________________________________________________________________
|
|
|
|
| 998 |
def runn():
|
| 999 |
# app.run(host="127.0.0.1")
|
| 1000 |
from gevent.pywsgi import WSGIServer
|
| 1001 |
-
http_server = WSGIServer(("
|
| 1002 |
http_server.serve_forever()
|
| 1003 |
# serve(app, host="127.0.0.1", port=8080)
|
| 1004 |
|
|
@@ -1014,16 +1008,24 @@ print(next_start)
|
|
| 1014 |
keep_alive()
|
| 1015 |
# active_path = "/TSA Team Folder/ADR Test/Test/"
|
| 1016 |
while 1:
|
|
|
|
| 1017 |
dtnNow = datetime.datetime.now(datetime.timezone.utc)
|
| 1018 |
print(dtnNow)
|
| 1019 |
if dtnNow >= next_start:
|
| 1020 |
next_start += datetime.timedelta(hours=12) # 1 day
|
| 1021 |
print(next_start)
|
|
|
|
| 1022 |
checkdropbox()
|
| 1023 |
-
|
|
|
|
|
|
|
|
|
|
| 1024 |
time.sleep(1800)
|
| 1025 |
-
|
|
|
|
|
|
|
| 1026 |
if __name__ == "__main__":
|
| 1027 |
-
runn()
|
| 1028 |
-
|
| 1029 |
-
|
|
|
|
|
|
| 53 |
global pdflink
|
| 54 |
# For 2.7
|
| 55 |
global hatched_areas2_7
|
| 56 |
+
|
| 57 |
# Configure Flask-Session for server-side session storage
|
| 58 |
+
app.config["SESSION_TYPE"] = "filesystem"
|
| 59 |
+
app.config["SESSION_PERMANENT"] = False
|
| 60 |
+
app.config["SESSION_FILE_DIR"] = "./flask_session_files"
|
| 61 |
+
app.secret_key = "your_secret_key"
|
| 62 |
|
| 63 |
# Initialize Flask-Session
|
| 64 |
+
sess = Session()
|
| 65 |
+
sess.init_app(app)
|
| 66 |
|
| 67 |
@app.route("/", methods=["GET", "POST"])
|
| 68 |
def getInfotoMeasure():
|
|
|
|
| 76 |
def check_password():
|
| 77 |
password = request.form.get("password")
|
| 78 |
correct_password = "c900"
|
| 79 |
+
|
| 80 |
if password == correct_password:
|
| 81 |
+
session["authenticated"] = True
|
| 82 |
+
return jsonify({"authenticated": True}), 200
|
|
|
|
| 83 |
else:
|
| 84 |
+
return jsonify({"authenticated": False}), 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
|
| 86 |
@app.route("/mainGUI", methods=["GET", "POST"])
|
| 87 |
def main_gui():
|
| 88 |
+
if "authenticated" not in session or not session["authenticated"]:
|
|
|
|
|
|
|
| 89 |
return redirect(url_for("password_page"))
|
| 90 |
+
return render_template("proposed-GUI.html")
|
| 91 |
|
| 92 |
|
| 93 |
|
|
|
|
| 988 |
|
| 989 |
#_________________________________________________________________________________________________________________________
|
| 990 |
#_________________________________________________________________________________________________________________________
|
| 991 |
+
|
| 992 |
def runn():
|
| 993 |
# app.run(host="127.0.0.1")
|
| 994 |
from gevent.pywsgi import WSGIServer
|
| 995 |
+
http_server = WSGIServer(("127.0.0.1", 5000), app)
|
| 996 |
http_server.serve_forever()
|
| 997 |
# serve(app, host="127.0.0.1", port=8080)
|
| 998 |
|
|
|
|
| 1008 |
keep_alive()
|
| 1009 |
# active_path = "/TSA Team Folder/ADR Test/Test/"
|
| 1010 |
while 1:
|
| 1011 |
+
# yearly_update()
|
| 1012 |
dtnNow = datetime.datetime.now(datetime.timezone.utc)
|
| 1013 |
print(dtnNow)
|
| 1014 |
if dtnNow >= next_start:
|
| 1015 |
next_start += datetime.timedelta(hours=12) # 1 day
|
| 1016 |
print(next_start)
|
| 1017 |
+
# print(active_path)
|
| 1018 |
checkdropbox()
|
| 1019 |
+
|
| 1020 |
+
# mainDBAlaa.download_NewlyAddedFiles(active_path)
|
| 1021 |
+
# do what needs to be done
|
| 1022 |
+
|
| 1023 |
time.sleep(1800)
|
| 1024 |
+
|
| 1025 |
+
# time.sleep(200)
|
| 1026 |
+
|
| 1027 |
if __name__ == "__main__":
|
| 1028 |
+
runn()
|
| 1029 |
+
# app.run(debug=True)
|
| 1030 |
+
# if __name__ == "__main__":
|
| 1031 |
+
# app.run(host="0.0.0.0", port=7860)
|