Short version :
Is there a standard way to associate Python internal server code with a telephone client application?
Long version :
I have several applications that I am considering to port phone calls. In general, applications are written in Python. Some of them have web interfaces, some of them are standalone Python applications with wxpython based interfaces.
Thus, each application has some client things that are already in html + javascript + css, or which I am happy to translate into html + javascript + css.
For the server side for some applications, it is enough to leave the server code on the server. But for some / most, I would like to pack the server-side logic using the phonegap application, so it could be a standalone application. This requirement comes from two needs. One of them is that many of these applications are used for emergency response and should work even when cell towers and other network infrastructure are not available. Another thing is that some of the applications are quite simple and do not require a client-server architecture - they just have a lot of "end logic" code written in Python.
Now I know that I can just port all this Python logic to javascript, but I was hoping to find a solution in which this significant code base could remain in Python.
My idea is that I could write a phonegap plugin that actually contains a full Python interpreter (at least complete enough to handle most of the material in my code base). (That is, both iOS and Android allow their own C code, so I should be able to compile Python - or at least most of it - from the source code, or simply reference the iOS and Android Python libraries that others built. )
Thus, in javascript code, I could call a call to some function, for example, "InvokeBackEndMethod ()". This will act just like an ajax call, but instead of a network call, it will send the / url / message request to the Python plugin. I understand that telephone plugins can maintain a constant state (for example, the database plugin allows you to make one call to open the database and subsequent calls to read it and close it). Thus, the server-side Python code can maintain its state in the same way as on a real server. Actually, a web framework such as cherrpy can work on Python code, so it really will be like running both the client and the server in the same mobile application.
My questions:
(1) Is this plan reasonable?
(2) Has someone already solved this problem? I was hoping to find a project called "phonegap server", and it will be essentially a "universal" extension of PhoneGap in the sense that it will receive arbitrary calls from the client and will send these calls of your choice. various mechanisms: Python, Java, mono, etc. (ie, this universal extension of the phone screen saver will be "expanded" by various language "plugins", and then these plugins, in turn, will be "expanded" by any business logic added by the user to this language). Perhaps most people donโt need such a project because they donโt have a requirement to run a disconnected one and / or they donโt have a large back code of logic that they would like to deploy in a stand-alone application, but leave it in the original language. But it seems like some people need it, no?