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 Adding Instances

Logesh Jayaraman
Logesh Jayaraman
445 Points

Class Name in Model

Do the Class Name in the Model should be the Name of App? Is it mandatory. I am getting the error as

"Product doesn't declare an explicit app_label and either isn't in an applic ation in INSTALLED_APPS or else was imported before its application was loaded. This will no longer be supported in Django 1.9. class Product(models.Model):"

Hi Logesh

The name of the model can be anything. Can you post your code.

thanks

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,454 Points

As stated in this SO answer:

As stated in the warning, this happens either :

  • When you're using a model which is not in an INSTALLED_APPS;
  • Or when you're using a model before its application is loaded.

Make sure the file containing Product is in a directory listed in settings.INSTALLED_APPS And that the directory includes a __init.py__ file and the file referencing your models.Product is listed later in the list, if in a different module.