Wednesday, October 29, 2014

Re: What is the purpose of the include function?

Hi Daniel, in this case I would think the latter would fail - the `include` function loads a URL conf module and then finds the `urlpatterns` attribute, whereas `admin.site.urls` is a class method that dynamically builds a list of URL patterns based on your installed apps. There's nothing to import in the latter case because there's no such `urls` module.

On Tuesday, October 28, 2014 5:51:48 PM UTC-4, Daniel Grace wrote:
Hi,
In reference to urls.py what is the purpose of the include function?  For example what is the difference between these two lines?
url(r'^admin/', admin.site.urls),
url(r'^admin/', include(admin.site.urls)),


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9ea33c73-6a9e-4a34-a904-e062bfe88fbb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment