Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7584889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:02:10+00:00 2026-05-30T19:02:10+00:00

I know there are frameworks that exist, but I am trying to use wsgi

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:02:12+00:00Added an answer on May 30, 2026 at 7:02 pm

    Web-apps are generally “shared-nothing”. In the context of WSGI, that means you have no idea how many times your application (and the counter with it) will be instantiated; that choice is up to the WSGI server which acts as your app’s container.

    If you want some notion of user sessions, you have to implement it explicitly, typically on top of cookies. If you want persistence, you need a component that explicitly supports it; that can be a shared database, or it can piggy-back on your cookie sessions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know there have been a few threads on this before, but I have
Let me begin by saying this; I know that similar questions exist, but they
Occasionally I will know that there is a .NET Framework function that returns a
Just want to know if there other optional wrapper framework available that generate client
I know there are non-standard frameworks such as commons-validator, and hibernate validator. I wanted
There are plenty of PHP frameworks out there as many of you know, and
I know there is a registry key indicating the install directory, but I don't
I know there are a lot of positive things mod-rewrite accomplishes. But are there
I'm trying to use Moles to mock the Socket class in System.Net.Sockets. I have
I have an object that I am trying to update using MVC(2), also using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.