Opened 13 years ago
Closed 12 years ago
#17026 closed Cleanup/optimization (fixed)
Message storage backends section missing "just use x"
Reported by: | Ram Rachum | Owned by: | Aymeric Augustin |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This section:
https://docs.djangoproject.com/en/1.3/ref/contrib/messages/#storage-backends
Is missing a "just use x" sentence. As a new user I have no idea which storage backend is generally preferable. SessionStorage
sounds best, but if FallbackStorage
tries to use cookies but only then resorts to session, this leads me to believe that cookies are somehow better for messages than the session.
Please clarify.
Change History (5)
comment:1 by , 13 years ago
Summary: | Docs section missing "just use x" → Message storage backends section missing "just use x" |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 by , 12 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Version: | 1.3 → master |
I came across this section of the docs today (while debugging #18781) and thought "oh, what are the advantages and drawbacks of the three storage backends?".
So... I'd like to revisit this ticket.
The backends were introduced in [25020ddb05] as a consequence of #4604. The discussion on the ticket is quite long but there's a good summary on the SessionMessages wiki page. Notably it mentions the following requirement:
Use the session only as a fallback: Avoid database/cache queries if possible, but support larger messages that don't fit in a cookie (> 4kb) when needed
I think the docs should say something along the lines of:
- FallbackStorage optimizes for the general case by using cookies for small messages, and the session only when messages don't fit in a cookie. In general, there's no reason to use anything else.
- if your site doesn't use
django.contrib.sessions
, use CookieStorage - if you have a good reason to keep your cookies minimal (hint: you probably don't), use SessionStorage
comment:4 by , 12 years ago
Owner: | changed from | to
---|---|
Status: | reopened → new |
comment:5 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Indeed, this section is a bit confusing, mostly because it describes complex backwards-compatibility code. It could use a better structure.