Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Basics Final Details url Tag

Brian Anstett
Brian Anstett
5,831 Points

A Quick Refresher on the scope between Django APPs and the "Main" (AKA: Stub, Default APP)

Working through this video, I quickly discovered a gap in my understanding on the "scope" of files, variables, etc between the main app (Stub) and its APPS.

Perhaps I'm not clear so allow my to elaborate. In the video, Kenneth simply references the view by 'views.home_XX'. But there are two 'views' correct? One in the Stub and another in the learning site APP.

Another example, when we name the URLs for both the Stub and the APP we can simply put in the Django url tag {% url '<url_name>' %} and not have specify which APP ( {% <appName.urls.name> %} ).

If I had to answer my own question, I would say, Its because Django URL mapping is module and the URL() function adds the correct mapping to the module and when we use the Django url tag, no matter where we use it in the project, we are referencing the same url mapping module

Just in general, if someone could help me clarify scopes of variables, templates, views, etc between the main APP (stub) and the other APPs