On 8/27/2010 2:07 PM, Bradley Hintze wrote:
> Ok, I hope I can explain my problem coherently :).
> 
> In development I ran my web app fine. I have now put it in production
> (configured and running on apache). In my views.py file I passed
> global variables between different functions (views) beautifully
> during development (manage.py runserver). However, when I run it on
> apache it seems, from the error page (i have debug on), that I cannot
> pass global variables between view.py functions (maybe apache 'calls'
> a fresh 'instance' of views.py making the old variables 'unavailable'
> (please excuse any errors in my attempts to use correct vocabulary).
> Does this mak sense? if so, Is there a way around this such that I can
> use variables created in on view function in another?
> 
> Bradley
> 
In testing, it's most unlikely that different requests will be handled
by different processes. In production this is more or less inevitable.

If you want data to be accessible over time (and I presume you want each
user to have their own values associated with the global variable?) you
need to store the data in the session object. The server maintains a
separate session for each originating IP address (I think - close enough
for a beginner, anyway), so data from different users does not get mixed up.

regards
 Steve
-- 
DjangoCon US 2010 September 7-9 http://djangocon.us/

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to