On Jan 12, 5:41 am, dahpgjgamgan <dahpgjgam...@gmail.com> wrote: > In the 4-part tutorial on Django's main site, there's a lot of advice > on how to decouple apps and projects, but when I look at the import > statements in most of the tutorial's files, it's always "from > projectname.appname.... import ....." - not very decoupled for me.
You can leave the mysite off various things. So in the settings file the INSTALLED_APPS you can put polls instead of mysite.polls. The same for the import statements. This works because the code is run in the mysite directory and python automatically finds modules in the directory the code is running in. In other words python considers the current working directory to be on the python path. > Am I missing something, is there a good reason why those imports look > like that and not simply "from appname... import ..."? I am wondering why the tutorial teaches this bad practice when there is so much emphasis in Django on reusable apps. It seems to me that teaching the better way of leaving off the site directory requires no code change but only a documentation change to the tutorial. Even better would be making the backwards incompatible change of removing the project directory from the python path to encourage better practice. But I also am just learning Django so probably have failed to consider something important. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---