0

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.

mmhan
  • 731
  • 7
  • 18
  • the prefix for the code above is `''` – mmhan Sep 30 '11 at 09:44
  • I would opt for the one that doesn't include the project name, as that encourages more reuse. The djangobook.com is quite out of date, I think you would get more out of the [django tutorial](https://docs.djangoproject.com/en/dev/intro/tutorial01/) on the main site. – mmcnickle Sep 30 '11 at 09:51
  • @MikeHan: Please do not add comments. Please **update** the question to be complete. – S.Lott Sep 30 '11 at 10:02

1 Answers1

1

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.

iamsk
  • 346
  • 5
  • 7