How use model objects in ver1.9 WITHOUT an app and get rid off "Model class doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS." error mssg?

67 views
Skip to first unread message

Chris Seberino

unread,
Apr 4, 2016, 5:23:42 PM4/4/16
to Django users
I'm trying to create a simple stripped down skeleton Django application.  Django ver1.9 forces
everything to be in apps which are not needed for this application.

When I try using models I get an error like the following:

"Model class doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS."

Is there an easy sane/safe way to deal with this so Django can run without any "apps" defined?

Thanks,

Chris

Mike Dewhirst

unread,
Apr 4, 2016, 8:03:29 PM4/4/16
to django...@googlegroups.com
On 5/04/2016 7:23 AM, Chris Seberino wrote:
> I'm trying to create a simple stripped down skeleton Django
> application. Django ver1.9 forces
> everything to be in apps which are not needed for this application.
>
> When I try using models I get an error like the following:
>
> "Model class doesn't declare an explicit app_label and isn't in an
> application in INSTALLED_APPS."
>
> Is there an easy sane/safe way to deal with this so Django can run
> without any "apps" defined?

Just think of an app actually being a namespace rather than an app.
Django uses INSTALLED_APPS entries just like a search path added to the
BASE_DIR so it can find your models.

If you don't want the app name in your table name in the database I
believe you can specify the db_table in your model meta options

Mike

>
> Thanks,
>
> Chris
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users...@googlegroups.com
> <mailto:django-users...@googlegroups.com>.
> To post to this group, send email to django...@googlegroups.com
> <mailto:django...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/e6414cba-ccb4-4bf0-81ca-7c2c26947467%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/e6414cba-ccb4-4bf0-81ca-7c2c26947467%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

Chris Seberino

unread,
Apr 5, 2016, 11:22:24 PM4/5/16
to Django users

Just think of an app actually being a namespace rather than an app.
Django uses INSTALLED_APPS entries just like a search path added to the
BASE_DIR so it can find your models.


Ah yes thanks.  That helped a lot.  I just needed to basically mention
the directory in settings.py and then all was fine.

cs 
Reply all
Reply to author
Forward
0 new messages