-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathapp.py
More file actions
49 lines (44 loc) · 1.46 KB
/
Copy pathapp.py
File metadata and controls
49 lines (44 loc) · 1.46 KB
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
from GameSPA.GameSPA import GameSPA
from Health.Health import Health
from initialization_package import app
from initialization_package.set_config import set_config
# Set configuration from environment variables.
set_config(app=app)
# Add a game view. The game view is actually contained within a class
# based on a MethodView. See flask_controllers/GameController.py
game_view = GameSPA.as_view('Game')
app.add_url_rule(
'/',
view_func=game_view,
methods=["GET", "POST", "PUT"]
)
# Add a health view. The health view is actually contained within a class
# based on a MethodView. See Health/Health.py
health_view = Health.as_view('Health')
app.add_url_rule(
'/health',
view_func=health_view,
methods=["GET"]
)
@app.after_request
def add_header(response):
"""
Add headers to both force latest IE rendering engine or Chrome Frame,
and also to cache the rendered page for 10 minutes.
"""
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "0"
response.headers['Cache-Control'] = 'public, max-age=0'
return response
#
# The "__main__" code block typically only executes when run from
# the command line, e.g. python app.py. The app.run call is ignored
# when called from environments like GAE.
#
if __name__ == "__main__":
app.run(
host=app.config["FLASK_HOST"],
port=app.config["FLASK_PORT"],
debug=True
)