7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Django Error: Application labels aren't unique, duplicates:

Last updated at Posted at 2020-04-27

エラー内容

setting.pyをいじっていたらエラーが出たときの話.以下エラー内容.
英文をきちんと読めばわかる話ですが、ここに書いてあるのは「ラベルが重複していますよ」とのことなので

django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: auth 

setting.py

以下のような設定

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.auth',
    'mysite.apps.MysiteConfig', 
    'mysite.templatetags.vendor',
    'rest_framework.authtoken',
    'rest_framework', 

解決策

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',       <--- 重複しているものどちらかを消す
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.auth',       <--- 重複しているものどちらかを消す
    'mysite.apps.MysiteConfig', 
    'mysite.templatetags.vendor',
    'rest_framework.authtoken',
    'rest_framework', 

訂正後

凡ミスでしたね.

Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).
April 27, 2020 - 14:30:39
Django version 3.0.5, using settings 'app.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
7
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?