pyra.webapp#
Responsible for serving the webapp.
- pyra.webapp.callback_dashboard() Response [source]#
Get dashboard data.
This should be used in a callback in order to update charts in the web app.
- Returns:
- Response
A response formatted as
flask.jsonify
.
See also
pyra.hardware.chart_data
This function sets up the data in the proper format.
Examples
>>> callback_dashboard() <Response ... bytes [200 OK]>
- pyra.webapp.docs(filename) send_from_directory [source]#
Serve the Sphinx html documentation.
Todo
This documentation needs to be improved.
- Parameters:
- filenamestr
The html filename to return.
- Returns:
- flask.send_from_directory
The requested documentation page.
Notes
The following routes trigger this function.
/docs/ /docs/<page.html>
Examples
>>> docs(filename='index.html')
- pyra.webapp.favicon() send_from_directory [source]#
Serve the favicon.ico file.
Todo
This documentation needs to be improved.
- Returns:
- flask.send_from_directory
The ico file.
Notes
The following routes trigger this function.
/favicon.ico
Examples
>>> favicon()
- pyra.webapp.home() render_template [source]#
Serve the webapp home page.
Todo
This documentation needs to be improved.
- Returns:
- render_template
The rendered page.
Notes
The following routes trigger this function.
/ /home
Examples
>>> home()
- pyra.webapp.start_webapp()[source]#
Start the webapp.
Start the flask webapp. This is placed in it’s own function to allow the ability to start the webapp within a thread in a simple way.
Examples
>>> start_webapp() * Serving Flask app 'pyra.webapp' (lazy loading) ... * Running on http://.../ (Press CTRL+C to quit)
>>> from pyra import threads >>> threads.run_in_thread(target=webapp.start_webapp, name='Flask', daemon=True).start() * Serving Flask app 'pyra.webapp' (lazy loading) ... * Running on http://.../ (Press CTRL+C to quit)