-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
134 lines (100 loc) · 3.83 KB
/
Copy pathmain.py
File metadata and controls
134 lines (100 loc) · 3.83 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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
import threading
# import "packages" from flask
from flask import render_template, make_response # import render_template from "public" flask libraries
# import "packages" from "this" project
from __init__ import app # Definitions initialization
# from model.jokes import initJokes
from model.users import initUsers
# setup APIs
# from api.covid import covid_api # Blueprint import api definition
# from api.joke import joke_api # Blueprint import api definition
from api.user import user_api # Blueprint import api definition
# setup App pages
from projects.projects import app_projects # Blueprint directory import projects definition
# register URIs
# app.register_blueprint(joke_api) # register api routes
# app.register_blueprint(covid_api) # register api routes
app.register_blueprint(user_api) # register api routes
app.register_blueprint(app_projects) # register app pages
@app.errorhandler(404) # catch for URL not found
def page_not_found(e):
# note that we set the 404 status explicitly
return render_template('404.html'), 404
@app.route('/') # connects default URL to index() function
def index():
return render_template("index.html")
@app.route('/stub/') # connects /stub/ URL to stub() function
def stub():
return render_template("stub.html")
@app.route('/page/') # connects /stub/ URL to stub() function
def page():
return render_template("page.html")
# @app.route('/1/') # connects /stub/ URL to stub() function
# def one():
# return render_template("1")
# @app.route('/2/') # connects /stub/ URL to stub() function
# def two():
# return render_template("2")
# @app.route('/3/') # connects /stub/ URL to stub() function
# def three():
# return render_template("3")
# @app.route('/4/') # connects /stub/ URL to stub() function
# def four():
# return render_template("4")
# @app.route('/5/') # connects /stub/ URL to stub() function
# def five():
# return render_template("5")
# @app.route('/6/') # connects /stub/ URL to stub() function
# def six():
# return render_template("6")
# @app.route('/7/') # connects /stub/ URL to stub() function
# def seven():
# return render_template("7")
# @app.route('/8/') # connects /stub/ URL to stub() function
# def eight():
# return render_template("8")
# @app.route('/9/') # connects /stub/ URL to stub() function
# def nine():
# return render_template("9")
# @app.route('/10/') # connects /stub/ URL to stub() function
# def ten():
# return render_template("10")
# @app.route('/11/') # connects /stub/ URL to stub() function
# def eleven():
# return render_template("11")
# @app.route('/12/') # connects /stub/ URL to stub() function
# def twelve():
# return render_template("12")
# @app.route('/13/') # connects /stub/ URL to stub() function
# def thirteen():
# return render_template("13")
# @app.route('/14/') # connects /stub/ URL to stub() function
# def fourteen():
# return render_template("14")
# @app.route('/15/') # connects /stub/ URL to stub() function
# def fifteen():
# return render_template("15")
# @app.route('/16/') # connects /stub/ URL to stub() function
# def sixteen():
# return render_template("16")
# @app.route('/17/') # connects /stub/ URL to stub() function
# def seventeen():
# return render_template("17")
# @app.route('/18/') # connects /stub/ URL to stub() function
# def eighteen():
# return render_template("18")
# @app.route('/19/') # connects /stub/ URL to stub() function
# def nineteen():
# return render_template("19")
# @app.route('/20/') # connects /stub/ URL to stub() function
# def twenty():
# return render_template("20")
@app.before_first_request
def activate_job():
# initJokes()
initUsers()
if __name__ == "__main__":
# change name for testing
from flask_cors import CORS
cors = CORS(app)
app.run(debug=True, host="0.0.0.0", port="8332")