RuntimeError: Model class xxx doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

Philipp

I refer to following GitHub repo which is based on Django 2.0 and cookiecutter-django: github.com/Apfelschuss/apfelschuss/tree/c8851430201daeb7d1d81c5a6b3c8a639ea27b02

I am getting the following error when trying to run the app:

RuntimeError: Model class votes.models.Author doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

Error appeared with this line of code.

I tried to do as described in https://stackoverflow.com/a/40206661/5894988 but without success:

config/settings/base.py

LOCAL_APPS = [
    "apfelschuss.votes.apps.VotesConfig"
]

apfelschuss/votes/apps.py

from django.apps import AppConfig


class VotesConfig(AppConfig):

    name = "apfelschuss.votes"
    verbose_name = "Votes"

Any idea what I am doing wrong?

If anyone is interested how to run the docker container of the repo. It is described here.

Philipp

Working with absolute imports in the view solved my issue. I changed .models to apfelschuss.votes.models.

Code that leads to runtime error:

from django.shortcuts import render

from .models import Voting

Issue solved with absolute import:

from django.shortcuts import render

from apfelschuss.votes.models import Voting

See commit on GitHub here.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

RuntimeError: Model class xxx.xxx doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

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

RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

Django: Model class user.models.Users doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

Error in shell: doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

Travis Error doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

Django model "doesn't declare an explicit app_label"

How does running a test in PyCharm result in an "Model class doesn't declare an explicit app_label" error?

RemovedInDjango19Warning: Model doesn't declare an explicit app_label

Django contrib comments: RuntimeError: Model class django_comments.models... application in INSTALLED_APPS

Unable to find explicit activity class that isn't a class

Application labels aren't unique, even though INSTALLED_APPS apps are unique

Common_Model.php exists, but doesn't declare class Common_Model

exists, but doesn't declare class Code Igniter

Can't run Celery task in Django - I either get "AppRegistryNotReady: Apps aren't loaded yet" or "RuntimeError: populate() isn't reentrant"

CDI producer method not working if defining class doesn't declare a scope

Discussion Question: Why doesn't dart allow to declare enums in class?

How to declare type that isn't variable

"XXX" does not exist. Change its name or declare it so that its usage doesn't result in a "ReferenceError"

App isn't installed android error

Dart extension - The method 'xxx' isn't defined for the type 'xxx'

The application xxx asked for scope Device.ReadWrite.All that doesn't exist on the resource xxx. Contact the vendor

Ubuntu App store doesn't show any installed application

The Label Isn't Updating

ClassNotFoundException: Didn't find class "com.xxx.xxx.Application" on path: DexPathList on Linux

MVC 5 Razor - Label isn't updated from class annotation

Django stops working with RuntimeError: populate() isn't reentrant

What does the error RuntimeError: populate() isn't reentrant mean

Has class isn't working?