Create a Framework
- Separate generic/reusable code from application-specific code
doris.py
is derived from Flask application class
- Store callbacks
- Provide a decorator method to register callbacks
- And helper methods to make the page, create placeholders for charts, etc.
- Application-specific code remains in
server.py
- Specify the page elements we want
- Callback to get data (application-specific)
- Helper function to make controls (which are then wrapped as a form)
- Again, no changes to
static/dashboard.js
Run
python server.py --seed 12345
- Go to http://127.0.0.1/5000
- Change the checkboxes
- Click the button to fetch data and redisplay chart