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 What are Models?

Shana HT
Shana HT
3,292 Points

I'm confused about how courses is setup. How does the courses know about Course and connect them?

so startapp creates courses settings.py lists app courses makemigration with courses

models.py defines the Course

How and where does it know to connect courses with Course, what am I missing?

1 Answer

Benjamin Lange
Benjamin Lange
16,178 Points

The connection between them is made by convention. Django knows that your models are defined in the model.py file of each app, so when you make your migrations for the courses app, it uses the model.py file in the courses app to create the Course table in the database.