Performance: Session framework configuration
This affects page load speed and server response time by managing how session data is stored and retrieved.
Jump into concepts and practice - no test required
SESSION_ENGINE = 'django.contrib.sessions.backends.cache' # Uses cache (e.g., Redis) for session storage
SESSION_ENGINE = 'django.contrib.sessions.backends.db' # Uses database for session storage by default
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Database session backend | N/A (server-side) | N/A | N/A | [X] Bad - increases server response time |
| Cache session backend | N/A (server-side) | N/A | N/A | [OK] Good - faster server response |
settings.py specifies the backend storage for sessions?SESSION_ENGINE.settings.py snippet:SESSION_ENGINE = 'django.contrib.sessions.backends.cache' SESSION_COOKIE_AGE = 1209600 # 2 weeks SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_ENGINE = 'django.contrib.sessions.backends.file' but get errors about missing directories. What is the likely cause?