Hi,
I'm currently streamlining my django app for speed. I'm using
memcached on my server (apache, django svn trunk version: 5718) with
the following settings.py:
CACHE_BACKEND = 'memcached://127.0.0.1:11211/'
CACHE_MIDDLEWARE_SECONDS = 180
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.cache.CacheMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.doc.XViewMiddleware',
)
>From my understanding should everything work fine, even with
authentication and sessions. But sessions and login/logout does not
work properly, which means that I can login and logout once ... but if
I try to login a second time (within the 180 secs cache timeout)
django won't set a session (test) cookie for the first request and
therefore failing to authenticate the user at the 2nd request (the
actual POST with the login data), because it thinks the browser does
not support cookies. As you can see below at "Debug Header 1, 2".
The debug log output from funkload (very good web app testing tool by
the way) is the following:
---- snip ----
test_app (test_app.app) ...
test_app: Starting -----------------------------------
test_app: setUp
test_app: GET: http://www.myapp.intern/account/login/
Page 1: LOGIN: Get login page ...
test_app: Done in 0.021s
test_app: Load css and images...
test_app: Done in 0.303s
Debug Header 1:
----
Date: Mon, 16 Jul 2007 15:39:17 GMT
Server: Apache/2.2.3 (Ubuntu) mod_wsgi/1.0-TRUNK Python/2.5.1
Content-Language: en
Expires: Mon, 16 Jul 2007 15:39:31 GMT
Vary: Cookie
Last-Modified: Mon, 16 Jul 2007 15:36:31 GMT
ETag: a0110f933c8d33582ef250825805e763
Cache-Control: max-age=180
Connection: close
Content-Type: text/html; charset=utf-8
----
test_app: POST: http://www.myapp.intern/account/login/ [('username',
'alex'), ('password', 'passwd'), ('this_is_the_login_form', '1'),
('post_data', ''), ('submit', 'Log in')]
Page 2: LOGIN: log in user alex ...
test_app: Done in 0.053s
test_app: Load css and images...
test_app: Done in 0.000s
Debug Header 2:
----
Date: Mon, 16 Jul 2007 15:39:17 GMT
Server: Apache/2.2.3 (Ubuntu) mod_wsgi/1.0-TRUNK Python/2.5.1
Vary: Cookie
Content-Language: en
Set-Cookie: sessionid=a494250077597d75ac89b65061982616;
Domain=.myapp.intern; expires=Tue, 17-Jul-2007 15:39:17 GMT; Max-
Age=86400; Path=/
Connection: close
Content-Type: text/html; charset=utf-8
---
---- snap ----
After waiting for 180 secs (or until my cache is expired) everything
works correctly again ... (just for the first request)
The questions here is: Is it a bug ... or is it feature?
Thanks for helping
Best regards
Alexander
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---