django-cached_authentication_middlewareA drop in replacement for Django's built in AuthenticationMiddleware that utilizes caching | |
Download |
django-cached_authentication_middleware Ranking & Summary
Advertisement
- License:
- MIT/X Consortium Lic...
- Price:
- FREE
- Publisher Name:
- Selwin Ong
- Publisher web site:
- https://github.com/ui/
django-cached_authentication_middleware Tags
django-cached_authentication_middleware Description
django-cached_authentication_middleware is a drop in replacement for django.contrib.auth's built in AuthenticationMiddleware. It tries to populate request.user by fetching user data from cache before falling back to the database.Installation- Install via pypi: pip install django-cached_authentication_middleware- Configure CACHES in django's settings.py: CACHES = { 'default': { 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache', 'LOCATION': '127.0.0.1:11211', 'TIMEOUT': 36000, } }- Replace django.contrib.auth.middleware.AuthenticationMiddleware with cached_auth.Middleware in settings.py: MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', #'django.contrib.auth.middleware.AuthenticationMiddleware' 'cached_auth.Middleware', )And you're done!Running TestsTo run the test suite:django-admin.py test cached_auth --settings=cached_auth.tests.settings --pythonpath=.Product's homepage
django-cached_authentication_middleware Related Software