-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
24 lines (24 loc) · 887 Bytes
/
app.py
File metadata and controls
24 lines (24 loc) · 887 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
# app.py
from flask import Flask
from reactpy.backend.flask import configure
from constants import HOST, PORT, DEBUG
from dotenv import load_dotenv
load_dotenv()
# components + routes
# ScreenController as main UI entry pt
from projectCode.components.State0.componentSet0 import ScreenController
from projectCode.routes.State0Routes import state0_bp
from projectCode.routes.State1Routes import state1_bp
from projectCode.routes.State2Routes import state2_bp
def create_app():
app = Flask(__name__)
# register api routes for each state
app.register_blueprint(state0_bp) # /api/state0/
app.register_blueprint(state1_bp) # /api/state1/
app.register_blueprint(state2_bp) # /api/state2/
# connect ReactPy frontend
configure(app, ScreenController)
return app
if __name__ == "__main__":
app = create_app()
app.run(host=HOST, port=PORT, debug=DEBUG)