MIDDLEWARE_CLASSES = (
# keep the following line before CommonMiddleware, or APPEND_SLASH will not work
'localeurl.middleware.LocaleURLMiddleware',
'django.middleware.common.CommonMiddleware',
# 'django.contrib.sessions.middleware.SessionMiddleware',
'gaesessions.DjangoSessionMiddleware',
)
INSTALLED_APPS = (
'appengine_django',
'localeurl',
# 'django.contrib.sessions',
'django.contrib.admin',
'rs',
)
# SESSION_ENGINE = ('django.contrib.sessions.backends.cached_db')
# SESSION_ENGINE = ('django.contrib.sessions.backends.db')
# SESSION_ENGINE = ('appengine_django.sessions.backends.db')
SESSION_EXPIRE_AT_BROWSER_CLOSE = True
SESSION_SAVE_EVERY_REQUEST = False
On Tue, Jul 12, 2011 at 9:25 PM, Alexander Marquardt
<alexander...@gmail.com> wrote:
Hi David, thanks for your response.
I have incorporated the DjangoSessionMiddleware into the MIDDLEWARE_CLASSES .. so I am not sure where I am going wrong ...
Also (just for your information), there are other references to sessions (from my previous implementation of sessions that used the appengine_django helper sessions functionality), that I am not sure about enabling or disabling with your software
INSTALLED_APPS has 'django.contrib.sessions' enabled, and SESSION_ENGINE can be set to appenging_django.sessions.backends.db (or it can be removed)..
With all the different options and combinations, I thought it would be useful if there were a django example available. Let me know if you have any suggestions, or might have a small example that I could try out ..
PS. Up until now, I have been using the built-in appengine_django helper sessions which work fine - but I wanted to try out your program since it looks cleaner and easier to understand.
It could very well just be a conflict between the old sessions implementation and your session handler.. I'll let you know if I figure out the problem, or look forward to any suggestions that you might have
Thanks and kind regards
Alexander
On Tue, Jul 12, 2011 at 9:07 PM, David Underhill
<dou...@gmail.com> wrote:
Hi Alexander,
Have you tried incorporating the DjangoSessionMiddleware? This middleware class should be installable just like any other Django middleware, and once used it should take care of initializing the session object for you on each request.
~ David
On Tue, Jul 12, 2011 at 10:33, Alexander Marquardt
<alexander...@gmail.com> wrote:
Hi David,
I have been experimenting with gae-sessions, and it looks really great .. however, I was curious if you know of a Django example implementation to help me understand where I am going wrong. I am running a website that uses fully custom logins (ie. no google accounts and no OpenID)
On line 490 in __init__.py (if request.session.is_accessed():), the program exits with the following error when trying to load the main page (ie. before a session or login even exists):
AttributeError: 'WSGIRequest' object has no attribute 'session'
Which makes sense considering that I have not yet assigned the session to the request object -- my problem is that I don't really know the best way (where or how) to add the session to the request object. For this reason, it would be useful to see an example Django implementation if one is available, or alternatively if you have any idea about how I should add the session to the request object (or perhaps ignore the session if it has not yet been assigned)..
Kind regards
Alexander Marquardt