State considerations when converting a python desktop application into a web app?
This question is a bit vague: some specifics, or even some code, would have helped.
There are two separate differences between running this as a desktop app and running it on the web. Lack of state is one issue, but it seems like the much more significant difference is the per-user configuration. You need some way of storing that configuration for each user.
Where you put that depends on how persistent you want it to be: the session is great for things that need to be persisted for an actual session, ie the time the user is actively using the app at one go, but don't necessarily need to be persisted beyond that or if the user logs in from a new machine. Otherwise, storing it explicitly in the database attached to the user record is a good way to go.
In terms of "what happens between requests", the answer as Bruno points out is "nothing". Each request is really a blank state: the only way to keep state is with a cookie, which is abstracted by the session framework. What you definitely don't want to do is try to keep any kind of global or module-level per-user state in your app, as that can't work: any state really is global, so applies to all users, and therefore is clearly not what you want here.
I'm confused as to what considerations should be taken into account when converting a desktop application into a web app. We have a desktop app written in python using the wxPython library for the GUI and its a very traditional application which sets up the main window and calls the app.Mainloop() method to sustain the GUI and respond to events. The application itself is a configuration utility that simply accepts file(s) and allows the user to configure it. Naturally, the program keeps track of all the changes made and responds to events in light of those changes.
I intend to serve this utility as part of a larger application using the Django framework hosted on an Apache server and expect many users to use it simultaneously. Once I remove the app.MainLoop() directive, as expected, running the app simply goes through the code once and exits. This is obviously not what I need, the application needs to remember the state.
So far, I've started to identify and decouple all GUI code from the core of the application so I can effectively reuse the core and decided to write the UI in JavaScript using frameworks such as jQuery to handle GUI events and such. Two obvious options of storing the state would be sessions and databases but I'm somewhat stuck while forming a big picture of how this will all work. What will happen between requests in terms of Django views? I would really appreciate it if someone could shed some light on the overall workflow.
Thank you.