Clone this wiki locally
Pyjamas and Pyjamas Desktop
This diagram explains the relationship between pyjamas and pyjamas desktop, showing how exactly the same application which conforms to the Pyjamas API can be used UNMODIFIED to run on both a web browser and also on the desktop.
-------> PYJD PYJS <----------- | desktop web browser | | | | | | ----------+------------ | | | | | | | start app HTTP Requests | on desktop (GET, POST, AJAX, JSONRPC) | with pyjd.py | | loader Web Server | program | | | Django / Pinax / Web2py / blah blah | | | | ^ ------------+------------ ^ | | | | | | Views Images Static HTML <----- Pyjamas Compiler | Forms SWF Static JS pyjs.py | JSONRPC etc. etc. build.py | | ^ ^ | | | Python front-end | -------<----<---- Source Code ----->---->------ (Conforms to Pyjamas API uses ui.py, DOM.py etc.)
- In order to run unmodified in both environments, the code MUST use the pyjamas API - ui.py, DOM.py etc.
- In order to run on the desktop, the code SHOULD not be passed through the Pyjamas compiler, but is simply executed as-is, as python, using the pyjd libraries (which in turn rely on pywebkitgtk with the webkit-glib bindings).
- A Web Server is STILL necessary - for both - in order to serve up images, SWF files etc.
- In BOTH cases, it is necessary to use Window.open, HTTPRequest.py (or JSONService.py) to interact with the web server.
- You MUST put such code - networking or database etc. - behind an HTTP-based interface (AJAX, HTTP GET/POST, JSONRPC etc.) running on the Web Server, even if that Web Server is running on the same desktop machine (on loopback 127.0.0.1).