Hi,
I'm trying to work with the session object in my application but it
doesn't work as expected.
So in my settings.py I have:
MIDDLEWARE_CLASSES = (
'django.middleware.gzip.GZipMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.transaction.TransactionMiddleware',
)
TEMPLATE_CONTEXT_PROCESSORS = (
"django.core.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.request",
)
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'mySite',
)
With this I can access the 'user' object in my templates if for
example I try authenticating a user in,
but not some other variables I set mannualy with request.session
['aVariable']='aValue'.
I use this for rendering : render_to_response('template.html',
context_instance=RequestContext(request)).
And in my templates: {{ request.session.aVariable }}
And there's some other thing that's not clear to me:
>From the above configuration I understand that django stores the
sessions in the database so if I want
to use file storage I'll have to add this to my settings.py :
SESSION_ENGINE = 'django.contrib.sessions.backends.file'
SESSION_COOKIE_AGE = 7200
SESSION_COOKIE_NAME = 'acookie'
SESSION_FILE_PATH = '/temp/django'
but then all the "session" thing stops working.
Is there something that I should enable or disable from my settings
file?
Thank you,
srn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---