Sunday, April 3, 2011

Re: Confusion with ROOT_URLCONF

In short, it has to be on your PYTHONPATH or in the local directory.
If you're importing from the local directory it always works (assuming
the subdirectory contains a file named __init__.py). The other path,
'foo.urls' works because 'foo' is in your PYTHONPATH.

Do whatever makes sense to you and won't blow up in your deployment
environment.

In Python, it's generally considered better to import using the full
path to prevent name collisions. However, if you're making a re-usable
Django app that will be imported in another project where you won't
know the full path, you may have to do "local" imports in your
views.py.

Shawn

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment