Fixed #2295 -- Improved docs/sessions.txt to note INSTALLED_APPS requirement.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3295 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-07-07 22:25:32 +00:00
parent df4331f3e9
commit 5f33157f62
1 changed files with 12 additions and 8 deletions

View File

@ -10,18 +10,22 @@ Cookies contain a session ID -- not the data itself.
Enabling sessions Enabling sessions
================= =================
Sessions are implemented via middleware_. Sessions are implemented via a piece of middleware_ and a Django model.
Turn session functionality on and off by editing the ``MIDDLEWARE_CLASSES`` To enable session functionality, do these two things:
setting. To activate sessions, make sure ``MIDDLEWARE_CLASSES`` contains
``'django.contrib.sessions.middleware.SessionMiddleware'``.
The default ``settings.py`` created by ``django-admin.py startproject`` has * Edit the ``MIDDLEWARE_CLASSES`` setting and make sure
``SessionMiddleware`` activated. ``MIDDLEWARE_CLASSES`` contains ``'django.contrib.sessions.middleware.SessionMiddleware'``.
The default ``settings.py`` created by ``django-admin.py startproject`` has
``SessionMiddleware`` activated.
* Add ``'django.contrib.sessions'`` to your ``INSTALLED_APPS`` setting, and
run ``manage.py syncdb`` to install the single database table that stores
session data.
If you don't want to use sessions, you might as well remove the If you don't want to use sessions, you might as well remove the
``SessionMiddleware`` line from ``MIDDLEWARE_CLASSES``. It'll save you a small ``SessionMiddleware`` line from ``MIDDLEWARE_CLASSES`` and ``'django.contrib.sessions'``
bit of overhead. from your ``INSTALLED_APPS``. It'll save you a small bit of overhead.
.. _middleware: http://www.djangoproject.com/documentation/middleware/ .. _middleware: http://www.djangoproject.com/documentation/middleware/