Reply
Thread Tools
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#1
Not sure if others have posted on this, if they have then this will 'bump' this idea.

So it turns out setting up a python webserver is really easy.

This opens possibility for all types of simple browser-based applications running in tear or microb, since the python program can have as much permissions as needed.

The webserver needs root permission to bind sockets but this can be permitted for your app via sudoers entry in deb postinstall.

I have found samples for setting up a web server in python. I also found samples for checking pop email in python.

So i figured i'd try to write an app that combined the two and wrote a python program which :
- Hosts a webserver
- Handles simple requests for email summaries
- Handles simple requests for email message retrieval (raw text)

And it works and is very fast but it doesnt strip images from any html encoded messages (SO DONT READ SPAM or ADS which might track image retrieval). And my sample hardcodes username, password, and popserver... but this could be saved in config file just like any other app.

I'm not sure i'll have time to develop this enough to accomodate all users, so i'll just point users to my python samples directory here :
http://wardenclyffetower.com/MaemoFiles/python/

My samples dont indicate this but for most apps your program launch script could :
- start python webserver, launching in background (append '&')
- launch browser, pointing to your web app
- then run simple python script to request a url such as 'http://localhost/quit.htm'
- and have your webserver use that as signal to quit

That would make your web app start and stop like any other app (or you could just let it keep running)

Still this is a viable development platform for persons who might want to use python power with familiar html user interface.

Last edited by pipeline; 2009-04-17 at 01:30.
 

The Following User Says Thank You to pipeline For This Useful Post:
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#2
You don't need root permission if you use a high port, i.e. a port number > 1024.
 

The Following User Says Thank You to pycage For This Useful Post:
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#3
Actually, web2py does this almost out of the box, as seen here. Not a speed champion though.
 

The Following User Says Thank You to attila77 For This Useful Post:
pipeline's Avatar
Posts: 693 | Thanked: 502 times | Joined on Jul 2007
#4
That does look interesting, has anyone made a deb for web2py?

I'll have to download and check it out.
 

The Following User Says Thank You to pipeline For This Useful Post:
fpp's Avatar
Posts: 2,853 | Thanked: 968 times | Joined on Nov 2005
#5
You don't need a deb for web2py - just unzip the archive (to internal flash or memory card) and run it. I've been using it this way for over a year with various homemade apps in my pocket. Also gave a talk at the Berlin gathering about it.
 

The Following 2 Users Say Thank You to fpp For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 13:54.