Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#14255 closed (fixed)

Factoring mysite out of tutorial imports

Reported by: adamend Owned by: nobody
Component: Documentation Version: master
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: UI/UX:


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" 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 adamend 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 5 years ago by adamend

comment:1 Changed 5 years ago by mtredinnick

  • Keywords sprintSep2010 added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 5 years ago by mtredinnick

  • Triage Stage changed from Unreviewed to Accepted

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 Changed 5 years ago by adamend

  • Cc adamendicott@… added

comment:4 Changed 5 years ago by timo

  • Triage Stage changed from Accepted to Ready for checkin

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

comment:5 Changed 5 years ago by adamend

I kept that because that listing is showing what gets generated by 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 Changed 5 years ago by DrMeers

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:7 Changed 5 years ago by DrMeers

(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