Opened 7 years ago

Closed 7 years ago

Last modified 7 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 Changed 7 years ago by Tim Graham

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 Changed 7 years ago by Patrick Beeson

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

comment:3 Changed 7 years ago by Patrick Beeson

Where do you recommend adding this in the release notes?

comment:4 Changed 7 years ago by Patrick Beeson

Owner: changed from nobody to Patrick Beeson
Status: newassigned

comment:5 Changed 7 years ago by Patrick Beeson

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 Changed 7 years ago by Tim Graham

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

comment:7 Changed 7 years ago by Collin Anderson

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 7 years ago by Collin Anderson (previous) (diff)

comment:8 Changed 7 years ago by Patrick Beeson

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

comment:9 Changed 7 years ago by Patrick Beeson

Triage Stage: AcceptedReady for checkin

comment:10 Changed 7 years ago by Collin Anderson

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 Changed 7 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In fb545e5a27369570076d0d34626f3c7e916ee2e4:

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

comment:12 Changed 7 years ago by Tim Graham <timograham@…>

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