• Register
0 votes
2.5k 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

Please log in or register to answer this question.

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 31 views
0 votes
1 answer 126 views
126 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, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 273 views
273 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, 2020 alecxe 7.5k points
0 votes
1 answer 2.1K views
2.1K 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 96 views
96 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, 2020 Martin K 6.6k points
1 vote
1 answer 173 views
173 views
Problem: Hi all This is a question from a noob who started coding a few hours back. print("Hello") print("name") print("hello") print("Let's do some math!") print(5 + "a") print("5 + 5") print("Thanks for playing along!") It says, “typeerror: unsupported operand type(s) for +: 'int' and 'str'” What does it mean?
asked Mar 9, 2020 Gavin 15.3k points
0 votes
1 answer 18 views
18 views
Problem: runtimewarning: divide by zero encountered in double_scalars
asked Feb 16 Ethan ross 1.9k points
0 votes
1 answer 581 views
581 views
Problem : Please find below my code for your reference. import os for root, dirs, files in os.walk('Path'):      for file in files:          if file.endswith('.c'):              with open(os.path.join(root, file)) as f:                     for line in f: ... already tried setting it with the open(os.path.join(root, file),'r',encoding='cp932') as f: but got the same above error
asked Jan 31, 2020 jwilliam 3.9k points
0 votes
1 answer 114 views
114 views
Problem : I am unable to understand what am I missing here: Sort my_short_names in reverse alphabetic order. The sample output from the given program as below : ['Tody', 'Samy', 'Joey', 'Jany', 'Anny'] Below is my code for your reference : my_short_names = ['Jany', 'Samy', 'Anny', 'Joey', 'Tody'] my_short_names.sort() print(my_short_names)
asked Jan 8, 2020 alecxe 7.5k points
0 votes
1 answer 2.5K views
2.5K views
Problem : MySample.csv contains the below details : NAME Id No Dept Tommy 1 12 CS Jimmy 2 35 EC Bonny 3 21 IT Franky 4 61 EE And my Python file contains the below code : import csv myifile = open('mysample.csv', "rb") read = csv.reader(myifile) for row in read : ... in for row in read : _csv.Error: iterator should return strings, not bytes (did you open the file in text mode?) How should I fix it?
asked Jan 2, 2020 alecxe 7.5k points