1

I have the following url patterns in ROOT_URLCONF:

urlpatterns = patterns('',
    url(r'^polls/', include('polls.urls')),
    url(r'^admin/', include(admin.site.urls)),
)

My question is how the include works. What is the difference between 'polls.urls' and polls.urls. The first one works and brings in the polls.urls.py file.

What does the include actually do? Can I be pointed to documentation? (When I google search for include, I only find out about template includes)

1 Answer 1

1

One is a string and the other is an object reference. You can't reference objects whose names aren't known.

import polls.urls

"Including other URLconfs"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.