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')
开发者_JS百科(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.
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.
精彩评论