What does include() in urls.py do in django?

0

Issue

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 the include() method becomes handy?

Solution

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.

Answered By – Tony Dare

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More