I was learning Django and noticed people directing the URLs file in the main directory of the project to a new created URL.py file in the app folder? Why can't we directly put the path in the URL file in the main directory?

Instead of using include, we could have directly put the path there. Why aren't we doing it?
Keeping URLs in separate apps provides certain advantages:
urls.pyrather than managing all URLs in the same mainurls.pyfile, which will be a hassle as the size of the project grows.Let's say you want to move all URLs for an app to a different location, like from
/api/to/api/v1/, all you'll need to do is to update the mainurls.pyfile and update the path where you include the app, instead of updating all the URLs individually!Or you want to remove an app, then all you need to do is remove the app itself and remove one line from the main
urls.py, instead of removing each URL and introducing a possibility that a URL was still left.Creating separate apps keeps everything clean, easy to find and manage. That's why URLs for each app is kept separate and are simply included in the main
urls.pyfile.