• Register
0 votes
1.7k views

Problem :

I am at my minds end. After a lot of hours of troubleshooting, probably more than 20, I thought I was finally in business, but then I got following error :

Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label 

There is no info on this on the web, and there is no solution out there has resolved my issue. Any solution would be a lot appreciated.

Please note I am currently using Python 3.4 and Django 1.10.

Below is the code from my settings.py:

INSTALLED_APPS = [
    'DeleteNote.apps.DeletenoteConfig',
    'LibrarySync.apps.LibrarysyncConfig',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

And below is my apps.py files :

from django.apps import AppConfig
class MyDeletenoteConfig(AppConfig):
name = 'MyDeleteNote'

and

from django.apps import AppConfig
class MyLibrarysyncConfig(AppConfig):
    name = 'MyLibrarySync'
6 5 3
7,540 points

1 Answer

0 votes

Solution :

I guess you are missing putting in your application name into your settings file. The myAppNameConfig is your default class generated at apps.py by the .manage.py createapp myAppName command. Where myAppName is your name of the app.

settings.py

INSTALLED_APPS = [
'myAppName.apps.myAppNameConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]

This is the way settings file finds out what you want to call your application. You can easily change how it looks later in your apps.py file by adding the below code in it

myAppName/apps.py

class myAppNameConfig(AppConfig):
    name = 'myAppName'
    verbose_name = 'A Much Better Name'

 

I hope this helps you in resolving your issue.

9 7 4
38,600 points

Related questions

0 votes
1 answer 57 views
57 views
Problem: I have freshly migrated my project from the old python2 to the new python3 and it has hundreds of the ForeignKey relations. I have very basic knowledge related to python. Using a solution to go line by line and add on_delete argument is not the possible. What ... it does not look like catching it somehow. Looking for a Python expert who can try to fix my above Python error very quickly.
asked Jul 15 Raphael Pacheco 4.9k points
0 votes
1 answer 218 views
218 views
Problem : When I try to run following command: python manage.py updatestats I get the error as below: “TypeError: int() argument must be a string, a bytes-like object or a number, not 'list'” I am unable to figure out ... ) File "/Users/alecxe/project/Dev/project_files/project/main/management/commands/updatestats.py", line 34, in handle unique_visits=display_unique_visits(hostname),)
asked Jan 2 alecxe 7.5k points
0 votes
1 answer 1.7K views
1.7K views
Problem : I am facing the issue in passing a function as a parameter to another function as follows typeerror: int() argument must be a string, a bytes-like object or a number, not 'nonetype'
asked Nov 18, 2019 peterlaw 6.9k points
1 vote
1 answer 45 views
45 views
Problem : I want to learn the python programming and also want to work on projects. One of my projects is to code the voting system so that it can select the best player among 23 players of a match by using the lists. I am currently using the Python3. Please ... any of the strings in my above code all my variables are of the type integers. Please guide me in fixing above python related error.
asked May 14 Martin K 6.6k points