-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.py
99 lines (72 loc) · 2.56 KB
/
views.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
from flask import request, render_template
from ttsg import app
from scripts.scene import Scene
###########################################################
@app.route("/")
def hello():
try:
return "<h1 style='color:blue'>Hello There!</h1>"
except Exception as e:
print("Exception in views.py (hello method): ", str(e))
###########################################################
@app.route("/ttsg")
def index():
try:
return render_template("index.html")
except Exception as e:
print("Exception in views.py (index method): ", str(e))
###########################################################
@app.route("/ttsg", methods = ['POST'])
@app.route("/ttsg/scene", methods = ["POST"])
def user_input():
try:
text = request.form['textInput']
image = Scene()
image.generate_scene(text)
return render_template("scene.html", path = '/static/images/scene.png')
except Exception as e:
print("Exception in views.py (user_input method): ", str(e))
###########################################################
@app.route("/ttsg/what")
def what():
try:
return render_template("what.html", title = "What is does")
except Exception as e:
print("Exception in views.py (what method): ", str(e))
###########################################################
@app.route("/ttsg/about")
def about():
try:
return render_template("about.html", title = "About us")
except Exception as e:
print("Exception in views.py (about method): ", str(e))
###########################################################
@app.route("/ttsg/how")
def how():
try:
return render_template("how.html", title = "How it works")
except Exception as e:
print("Exception in views.py (how method): ", str(e))
###########################################################
@app.route("/ttsg/scene")
def scene():
try:
return render_template("scene.html", title = "TTSG-Scene")
except Exception as e:
print("Exception in views.py (scene method): ", str(e))
#########################################################
@app.after_request
def add_header(response):
# response.cache_control.no_store = True
response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'
response.headers['Pragma'] = 'no-cache'
response.headers['Expires'] = '-1'
return response
###########################################################
@app.route("/admin-ttsg")
def admin_login():
try:
return render_template("admin_login.html")
except Exception as e:
print("Exception in views.py (index method): ", str(e))
###########################################################