Hello,

this is my first post on this group. I just started using Django
yesterday, reading throuhg the online Django Book
(www.djangobook.com).

In chapter 3, for the URLconf, the authors put:

from django.conf.urls.defaults import *
from mysite.views import current_datetime

urlpatterns = patterns('',
    (r'^time/$', current_datetime),
)

mysite is the root directory of the project and the files all reside
within this folder.

I don't understand why they use:
from mysite.views import current_datetime
instead of
from views import current_datetime

Both work, but I don't see why. The mysite directory is on the python
path, not its parent. Why is it possible at all to write from
mysite.views ... ? Is this handled internally by python?

There are some guys that asked the same question directly in the book
(via the comments on the left side), but there was no explanation
posted.

Since both work, why would one use the first possibility over the
second one? If one would change the project name one would need to
modify the import statements (when using the first possibility)

My project just runs fine, but I would like to understand why, so if
anybody could give me a hint...

Best regards,
antoine
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to