web and standalone access

Luke Kenneth Casson Leighton lkcl at lkcl.net
Sun Oct 17 02:14:02 CEST 2010


On Tue, Aug 3, 2010 at 6:15 PM, S.Selvam <s.selvams... at gmail.com> wrote:
> I have a case where my application needs to run as a standalone application
> and also allow web based access.

> What could the best python framework to implement it.

well, the total number of options available is about err... one,
possibly two.  one is pyjamas, the other is _maybe_ appcelerator.

pyjamas has a python-to-javascript compiler and also has
pyjamas-desktop which is a bit of a cheat because it uses the exact
same engines that the major web browsers do, but rather than getting
all the lovely crud that you get with the web browser, you get err a
window, and that's it: no back buttons, url bar, menu bar, nothing -
it's all up to you, exactly as it is with pygtk2, pyqt4 or any other
desktop-based UI widget engine.

pyjd is also a bit of a cheat because although the application is
really really python not javascript, you still have to split the app
along MVC lines and still have to use AJAX (XMLHttpRequest) just as
you would with the web version, but this time from python not from
javascript.  illustrated here:

http://lkcl.net/pyjamas.desktop.diagram.html
http://lkcl.net/pyjamas.diagram.html

this split actually has significant advantages, one of which is that
heavy back-end processing and anything else that takes an inordinate
amount of time can be done back-end web server end, and, given that
you're forced to use AJAX to communicate with that, you _have_ to
design the UI front-end as asynchronous.

try to avoid using threads: all three of the desktop web engines are a
bit sensitive about allowing access to their internal data structures
whilst other threads are also doing the same thing: browser engines
all all designed to operate around a single-threaded javascript
engine, and the locking functions are all typically hidden inside
internal APIs.  so, you play by the rules, and everything stays
hunky-dory.

so - yeah: http://pyjs.org

other than that: try looking at appcelerator, i understand that you
can get IronPython to run in it, or some-such, on windows.  don't know
too many details.

l.



More information about the Python-list mailing list