Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#23427 closed Cleanup/optimization (fixed)

Doc update to account for runserver behavior when starting project

Reported by: Patrick Beeson Owned by: Patrick Beeson
Component: Documentation Version: 1.7
Severity: Normal Keywords: docs tutorial
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

In 1.7, running runserver before running migrate when creating a new project creates a db file (sqlite by default). This isn't clear in the tutorial docs, and is different behavior than what occurred in previous versions. You'll also get a nasty server error when viewing localhost in your browser.

I propose updating the first tutorial page to account for this to avoid confusing folks new to Django, or new to 1.7 from a previous version.

Change History (12)

comment:1 by Tim Graham, 10 years ago

Easy pickings: set
Triage Stage: UnreviewedAccepted

As discussed in #django-sprint, a mention in the release notes would be fine. Suggested text: "With the addition of the SessionAuthenticationMiddleware to the default project template, a database must be created before accessing a page using runserver."

comment:2 by Patrick Beeson, 10 years ago

I'd be happy to assign this ticket to myself, using the suggested text.

comment:3 by Patrick Beeson, 10 years ago

Where do you recommend adding this in the release notes?

comment:4 by Patrick Beeson, 10 years ago

Owner: changed from nobody to Patrick Beeson
Status: newassigned

comment:5 by Patrick Beeson, 10 years ago

This update looks most appropriate under miscellaneous (https://docs.djangoproject.com/en/1.7/releases/1.7/#miscellaneous) or management commands (https://docs.djangoproject.com/en/1.7/releases/1.7/#management-commands), especially since the latter mentions runserver specifically.

comment:6 by Tim Graham, 10 years ago

I'd go for the first suggestion, since the second is under "Minor Features" which this isn't.

comment:7 by Collin Anderson, 10 years ago

If it helps, it's only an issue if you already have a sessionid cookie for the domain, so it shouldn't be an issue for everyone.

As a side note, probably not possible with just middleware, but it would be nice if the session authentication check was done the first time get_user(request) is called, instead of every request, as it creates unnecessary session and user queries on pages where user is not used. It would be nice if there were a way to override the get_user(request) logic to put this check there. That would remove the requirement to have a database before using a runserver for the first time.

An alternative could be to enable signed_cookies by default, as that would also remove the database requirement.

Last edited 10 years ago by Collin Anderson (previous) (diff)

comment:8 by Patrick Beeson, 10 years ago

Pull request issued for release docs update: https://github.com/django/django/pull/3166

comment:9 by Patrick Beeson, 10 years ago

Triage Stage: AcceptedReady for checkin

comment:10 by Collin Anderson, 10 years ago

Has patch: set
Triage Stage: Ready for checkinAccepted

"has patch" is the proper state, currently. you shouldn't "ready for checkin" your own patch.

comment:11 by Tim Graham <timograham@…>, 10 years ago

Resolution: fixed
Status: assignedclosed

In fb545e5a27369570076d0d34626f3c7e916ee2e4:

Fixed #23427 -- Documented migrate is required before runserver for default projects.

comment:12 by Tim Graham <timograham@…>, 10 years ago

In d4ef9a4a21ecf897ebcbdc49737fdb5b210fbb98:

[1.7.x] Fixed #23427 -- Documented migrate is required before runserver for default projects.

Backport of fb545e5a27 from master

Note: See TracTickets for help on using tickets.
Back to Top