[time-nuts] beaglebones, time, web services

Simon Marsh subscriptions at burble.com
Sat Jul 4 16:42:48 EDT 2015


On 04/07/2015 14:13, Jim Lux wrote:
...
> BUT now, I'd like to add a web interface, so that it can be 
> manipulated by a mobile device using a browser.
...
> Is the best scheme to go in and modify the webserver code to look for 
> specific URLs requested, and then fire off some custom code to do what 
> I want?
...

No, almost certainly not.

Pretty much every webserver ever written allows you to run a script in 
response to a request. Nowadays there are frameworks that integrate 
closely with the language of your choice and do all the heavy lifting 
for you.

If fact, the problem is really too much choice, here's a list of 
frameworks from the Python wiki:
https://wiki.python.org/moin/WebFrameworks

If you want lots of functionality then head for the top of the list, but 
these are overkill for what you are trying to do.

Scroll down to the 'Non Full Stack Frameworks' and pick one that makes 
sense to you. These should all allow you to route a URL to some Python 
code, and the process should be simple enough that if you spend more 
than 15 mins to get an example up and running then just ditch it and 
move on to the next one.

One caveat, if you are planning to put this on the public internet then 
it's a very good idea to proxy the service behind a 'full-fat' webserver 
(e.g. apache) that can safely manage access, load, security etc. I 
wouldn't expose a BBB directly to the Internet, especially one that is 
controlling expensive physical things.


Simon




More information about the time-nuts mailing list