In django there is a concept that makes me dazzled a bit.Why we should make a urls.py in our app folder while we have one in project folder.
what is the specific job each one do ?
how both have relation with each other e.g how do they interact with each other to make a django website ?
The
urls.pyin your project folder are the "base" URLs for your site. You can then forward requests made on a certain route to your app'surls.pyusinginclude.Here is an example :
And then in
myapp.urls:So for instance, if I request "localhost:8000/myapp/contact", your project's
urls.pywill detect that it must forward the request to your appmyapp, which will call its viewviews.contact.