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

  • Home
  • SEARCH
  • 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 3998540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T07:32:17+00:00 2026-05-20T07:32:17+00:00

In my multiple choice Quiz show project on google app engine multiple users can

  • 0

In my multiple choice Quiz show project on google app engine multiple users can use the webapp simultaneously once they are login. But due to some reason they are interfering with each others instances.
Scenario example: Suppose user A wants to use the quiz show for 10 questions and at the same time user B wants to run the quiz show for 10 questions on another machine. But since they are using the application at the same, they are only getting 5 questions each and their result getting messed up.
Does anybody know how to avoid it ? I am not using any session or cookies till now. Is that a solution or something else?
Thanks

#views.py

def display(request):
skipped_questions=[]
question_number=[]
user_answer_list=[]
answer_list=[]
all_questions=[]
if request.method==’POST’:
initial_value=1
id_list=[]
result=Questions.objects.all()
for i in result:
id_value=i.id
id_list.append(id_value)

    data=request.POST.copy()
    total_question=data['number_of_question']
    mytime=data['time']
    seconds=59
    minutes=int(mytime)-1
    already_questions=Random_model.objects.all().delete()
    already_answers=User_answer.objects.all().delete()
    random_questions_list=random.sample(id_list,int(total_question))
    for i in random_questions_list:
        random_model=Random_model()
        random_model.list_id=i
        random_model.initial_value=int(initial_value)
        random_model.save()
        initial_value+=1
    question_list=1
    a=Random_model.objects.get(initial_value=question_list)
    new_question=Questions.objects.get(id=a.list_id)
    template_value={ 'output': new_question,'minutes':minutes,'seconds':seconds,'question_list':question_list }
    return render_to_response("quiz.html",template_value)

Followup-@Adam:Hi,I have removed global variables and again the program is working fine when I am working alone on my laptop. But when I am asking my colleague to try from his end,we both are getting same questions and interfering in each others sessions due to which end output getting messed up. I started using gae-sessions and able to use request.session but how should I use gae-sessions in this scenario.
Let me know if I am not clear.

  • 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-20T07:32:18+00:00Added an answer on May 20, 2026 at 7:32 am

    Without some concrete details about what kind of data your application stores to make one session different from any other, it is impossible to give you anything really useful, but one approach would be to store it in memcache keyed off of the user’s user_id.

    Completely hypothetical for-example code:

    def get_session_data():
        from google.appengine.api import users
    
        found_session = None
    
        user = users.get_current_user()
        if user:
            from google.appengine.api import memcache
    
            users_session = memcache.get(user.user_id())
    
    
        return found_session
    
    def save_session_data(session_object):
        from google.appengine.api import users
        from google.appengine.api import memcache
    
        memcache.set(users.get_current_user().user_id(), serialized_object)
    

    Now, before you go cutting and pasting, there are a lot of caveats to this approach, and it is meant only as a suggested starting point. Memcache is not guaranteed to hold items in memory, and there are plenty of other competing implementations that would be more reliable in some respects.

    Fundamentally, I’d suggest using cookies to store the session data, but AppEngine doesn’t have native support for cookies, so you’d have to go find an implementation of them and include it in your code. There are a number of fine implementations that are available on Google Code.

    Here are some libraries to pick from that provide cookie support. There are even more.

    gae-utilities

    gae-sessions

    app-engine-oil

    FOLLOWUP, based on the sample code that you just added:
    I don’t want to put too fine of a point on it, but what you’re doing just ain’t gonna work.

    Using global variables is generally a bad idea, but it is specifically an unworkable idea in a piece of code that is going to be called by many different users in an overlapping-fashion. The best advice that I can give you is to take all of the painful global variables (which are really specific to a particular user), and store them in a dictionary that is specific to a particular user. The pickling/unpickling code that I posted above is a workable approach, but seriously, until you get rid of those globals, your code isn’t going to work.

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

Sidebar

Related Questions

I'm building a CLI survey app in Java that lets users answer multiple-choice questions.
For a multiple choice quiz application i would like to show the dummy answers
How can i save the info from a multiple choice listview into the database?
I'm writing a survey website where users are asked multiple choice questions. Designing the
I am writing some code to allow users to answer multiple choice questions. So
I am building a online form, with about 20 multiple choice checkboxes. I can
Problem: I'm trying to code a multiple choice quiz for my fellow students -and
I am trying to create a multiple choice exam type app. I have the
I am trying to create a multiple choice test app. I have this code
I'm quite new to Android and I'm trying to use a custom multiple choice

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.