Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#14255 closed (fixed)

Factoring mysite out of tutorial imports

Reported by: Adam Endicott Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords: sprintSep2010
Cc: adamendicott@… Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

It seems desirable to not teach people the bad habit of including the project name in their app code, though the tutorial currently does this. I have looked at previously closed tickets, which recommend just replacing the reference to mysite when redoing the urlpatterns. This goes further, and makes changes through all four tutorials. Of particular note are Russell's comments on #14216 and #11464 that mention a new tutorial or a tutorial rewrite to introduce reusable apps. I'm not sure this is necessary, as the current tutorial seems to work fine if you just remove the bad habit part, but I'm willing to do a more extensive rewrite or add a section if that's deemed necessary (FYI, I'm planning a bit more tutorial refactoring/addition, this is a first step).

The included patch does the following:

  • Removes all mentions of mysite in code. So for instance, import from polls.models, not from mysite.polls.models
  • Replaces the paragraph below the "Projecs vs. apps" admonition. It used to talk about coupling the app to the project with the imports. It now says that your apps can live anywhere on the Python path and that we will create the poll app inside the myapp directory in this tutorial.
  • Changes the copy in the "Bypassing manage.py" adminotion to say that polls should also be on your Python path if you want to go this route.

Attachments (1)

mysite_refactor.diff (11.3 KB ) - added by Adam Endicott 14 years ago.

Download all attachments as: .zip

Change History (8)

by Adam Endicott, 14 years ago

Attachment: mysite_refactor.diff added

comment:1 by Malcolm Tredinnick, 14 years ago

Keywords: sprintSep2010 added

comment:2 by Malcolm Tredinnick, 14 years ago

Triage Stage: UnreviewedAccepted

On first read through, this looks good. I'll apply it and work through the tutorial (or somebody else can) later to double-check.

comment:3 by Adam Endicott, 14 years ago

Cc: adamendicott@… added

comment:4 by Tim Graham, 13 years ago

Triage Stage: AcceptedReady for checkin

Looks good to me. The only other change that the committer might want to make is to change mysite.foo.urls to foo.urls in tutorial02.txt

comment:5 by Adam Endicott, 13 years ago

I kept that mysite.foo.urls because that listing is showing what gets generated by django-admin.py startproject. Could go either way on it, but I figure might as well reflect reality there. Perhaps the startproject command should be changed in this respect, but that's out of the scope of this ticket.

comment:6 by Simon Meers, 13 years ago

Resolution: fixed
Status: newclosed

(In [14066]) Fixed #14255 -- factor project name out of app imports in tutorial. Thanks to adamend for the report and initial patch.

comment:7 by Simon Meers, 13 years ago

(In [14067]) [1.2.X] Fixed #14255 -- factor project name out of app imports in tutorial. Thanks to adamend for the report and initial patch.

Backport of r14066 from trunk.

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