Starting with urls.py

Even if you have access to the entire source code of a Django site, figuring out how it works across various apps can be daunting. Often, it is best to start from the root URLconf located in the urls.pyfile since it is literally a map that ties every request to the respective views.

With normal Python programs, I often start reading from the start of its execution–say, from the top-level main module or wherever the __main__ check idiom starts. In the case of Django applications, I usually start with urls.py since it is easier to follow the flow of execution based on the various URL patterns a site has.

In Linux, you can use the following find command to locate the settings.py file and the corresponding line specifying ...

Get Django Design Patterns and Best Practices - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.