What does include() in urls.py do in django?
10,487
include()
adds urls from your app directory's urls.py
to the main urls.py (in memory). This keeps the main urls.py from getting too big to read.
see https://docs.djangoproject.com/en/2.2/topics/http/urls/
The Including Other URLConfs section.
Related videos on Youtube
Comments
-
Mangu Singh Rajpurohit over 1 year
I am new to django. I came across the
include()
method. I read the documentation regarding it. But couldn't understand it as it lacked suitable examples. I am again rewriting this question in a proper way so that it doesn't sound baseless. Can someone please help me out by giving me a suitable example regarding the scenario in which theinclude()
method becomes handy?-
Daniel Roseman almost 9 yearsYou've answered your own question, it includes another urls file. Why are you asking?
-
Mangu Singh Rajpurohit almost 9 years@DanielRoseman, if you don't want to answer, then don't answer, I am asking about how remapping is done ?
-
Mangu Singh Rajpurohit almost 9 years@Rexford, django docs is very big and I am not able to understand, from where to start. Whatever topic I read, I am finding the references of other topics, which are not known to me. So, I think, It's better to ask it over here. But knowledgeable users like you, instead of answering, downvotes the question.
-
-
Admin over 2 yearsAs it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.