5

A little help on Django

So I just started learning Python and Django Framework and I have one question...

Are the variables shared between visitors?
I mean, let's say I have a variable named "school"
school = "school1"
A visitor from X location enters and changes this variable to "school2". A new visitor enters the page from Y location and reads the variable 'school'. What is going to show on visitor Y? "school1" or "school2".

Comments
  • 0
    Normally, we would use what is known as user sessions to control the manipulation of data content. E.g user a is logged in as is manipulating file a, user b logs in and manipulates file a, if no control over sessions is handled we get errors or unhandled shit. Take a todo app as an example to see what i mean, most todo apps have no control over sessions since they are normally presented as client implementations. It is through the server side where you can limit how changes what and under what circumstances. Anyone do correct me if I am wrong please.
  • 0
    Assuming u declared it in global scope of views.py ( which is only imported once) school2, but if it is inside a view it is going be school1.
Add Comment