1

I am developing a django web project that uses the following packages/applications:

  • sorl-thumbnail
  • django-oscar

Here is a snippet of my settings.py file:

INSTALLED_APPS = [
    'registration', #should be immediately above 'django.contrib.auth'
    'django.contrib.auth',
    # ...
    'zinnia',
    'zinnia_tinymce',
    'sorl.thumbnail',
    'embed_video',
    # ...
    'django.contrib.flatpages',
        'compressor',
        'widget_tweaks',
    ] + get_core_apps()

When I comment out sorl.thumbnail, I am able to run the development server using manage.py runserver. However, if I uncomment the sorl.thumbnail line and try to run the development server, it throws an exception:

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

Now, I am aware that a similar question exists on this site, however, following the instructions in the accepted solution, i.e.:

  • create a sol_thumbnail folder in same directory as the manage.py script
  • create sorl_thumbnail/apps.py (see below)
  • modify myproject/mysite/___init____.py (see below)

sorl-thumbnail/apps.py

from django.apps import AppConfig

class SorlthumbnailConfig(AppConfig):
    name = 'sorl-thumbnail'
    label = 'sorl.thumbnail'

myproject/mysite/_init _.py

default_app_config = 'sorl-thumbnail.apps.SorlthumbnailConfig'

Why is the fix above not working, and how do I resolve this issue?

BTW: I am using django-1.10

Homunculus Reticulli
  • 65,167
  • 81
  • 216
  • 341

1 Answers1

2

I went though the same problem of duplicated applications, and following exactly the similar question I solved my problem.

The problem with your solution is that you have added default_app_config = 'sorl-thumbnail.apps.SorlthumbnailConfig' to myproject/mysite/___init____.py, but you should have added to myproject/sorl-thumbnail/___init____.py.

Ruben Alves
  • 166
  • 4
  • 12