Setting up Bottle - python web framework
-
I created a video on how I setup the Omega to install and run Bottle, a python web framework.
https://www.youtube.com/watch?v=GJCcIlCJOx4
There is another post in the forums, 'Python web framework' which shows you how to use python3. This particular setup video uses python2.
Here is the summary of steps:
vi /etc/opkg.conf
— delete line ‘option check_signature 1'
opkg update mkdir -p /home/bottle cd /home/bottle wget --no-check-certificate https://github.com/defnull/bottle/raw/master/bottle.py opkg install python-light opkg install python-email opkg install python-codecs opkg install python-logging opkg install python-openssl vi bottle_test.py
paste:
from bottle import route, run @route('/hello/<username>') def hello(username): return "Hello {0}. Welcome to the Omega World!".format(username) run(host='0.0.0.0', port=8080, debug=True)
to run:
python bottle_test.py
-
Thanks for sharing. I think Bottle has a lot of potential on the Omega as it is quite small and easy to use.
-
@Patrick-Ryan Nice tutorial!
-
Cool, thanks for that. I was wondering if it is possible and feasible to add websocket support to this setup.
Or might there be a way to add websocket support to the uhttp deamon. This is running the oem onion Web console AFAIK. Would it make any sense to look into making uhttp somehow support websockets and simple lua scripts?
Or, can ubus be used to push system events into a page?