Question

I'm new to Django and been reading the http://djangobook.com and finds that the following two patterns work the same way with no hiccups for project named mysite and views.py on the project root with a function named hello.

(r'^hello/$', 'mysite.views.hello')
(r'^hello/$', 'views.hello)

May I know what's the practice like? with or without the proceeding Project namespace? And if I may, why?

'' is the prefix for these patterns.

Was it helpful?

Solution

the fisrt one is because the mysite dir is in your python path;

the second one is because when your run the project, the current path will add to python path.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top