I know there are frameworks that exist, but I am trying to use wsgi directly to improve my own understanding.
I have my wsgi handler, and up at the top I have declared a variable i = 0.
In my application(environ, start_response) function, I declare global i, then I increment i whenever a button is pressed.
It is my understanding that the state of this variable is preserved as long as the server is running, so all users of the web app see the same i.
If I declare i inside the application function, then the value of i resets to 0 any time a request is made.
I'm wondering, how do you preserve i between a single user's requests, but not have it preserved across different users' sessions? So, a single user can make multiple posts, and i will increment, but if another user visits the web app, they start with i=0.
And I know you could store i in a database between posts, but is it possible to just keep i in memory between posts?