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 Model Administration Django's Admin

Sahar Nasiri
Sahar Nasiri
7,454 Points

admin.py

Why is the admin.py file in the courses folder not in the root learning_site folder?

Aimn Blbol
Aimn Blbol
10,352 Points

Each app has its own admin.py. So if your project is learn_site and your have 2 apps in there, then each app will have its own admin.py. This way you can choose which app to add to your site admin panal. I hope that helps.

Sahar Nasiri
Sahar Nasiri
7,454 Points

Thanks.

I get what you're saying, but it seems that we have a learning_site application too, you know in the learning_site folder inside of the learning_site root folder. I meant that why don't we have an admin.py file in there? Isn't an application?

Paco Rosales
Paco Rosales
663 Points

I think the outer learning_site folder is just for organization, in fact you can change its name to wathever you want (I like to call it "src"), what maters is the apps and "stub" folders inside

Aimn Blbol
Aimn Blbol
10,352 Points

learning_site is the project, courses is the the app. if you want to add your app models (courses models) in the admin, then create the admin.py in the app (courses) and use it to register your courses models. If you have another app in learning_site, then do the same thing

1 Answer

__ROLLER__ Angel
__ROLLER__ Angel
25,606 Points

Having it in the root would get really messy if you have a lot of apps, this is Python so they think about things like that ahead of time to help you out down the road.