urls.py file recommended to create in app folder?

Hello everybody,

I am learning Django with tutorials online and I have seen already different recommendations. I would like to know what you would propose to learn as beginner. Now I have the change to learn the ‘best’ way of Django.

My question is about to add an urls.py file in the app folder in my project or not?

I feel more comfortable and find it easier to DO NOT use an urls.py file in the app folder but I would like to know if to create an urls.py file in the app file is the ‘best practice’ in Django.

As an tutorial example for the creation of an urls.py file in the app: pages: Django Favicon Tutorial | LearnDjango.com
After the setup of Django the URLS are setting up.

I hope my question is understandable even without code added in my topic. If recommended to add every time some code, I will keep this in mind for my next question.

Thank you
Doro

I deleted the post by mistake… sorry

There is no “one best” way in the absence of the context of the application being built. If you’re building everything as a single app, it probably doesn’t matter a whole lot either way.

However, if you’re building a system with multiple apps you’ll probably find that it is easier to keep everything associated with the apps together.

If you’re using third-party apps, you’re already likely to have urls from included sources, so the urls are already going to be distributed across multiple files.

It’s really up to you and your judgement as to how understandable and maintainable it’s going to be either way.

I really like the way you are answering to posts without judgement but with your opinion and with guidance.

That is true. I have to think about later what will be easier but it is still really hard because I have too less experience, yet…

Thank you