Factoring mysite out of tutorial imports
|Reported by:||adamend||Owned by:||nobody|
|Cc:||adamendicott@…||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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.
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