#32642: RuntimeError: 'apps.core.apps' declares more than one default AppConfig
on
custom admin setup
-------------------------------+--------------------------------------
Reporter: Ron | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 3.2
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Julien Chiron):
* cc: Julien Chiron (added)
* status: closed => new
* resolution: invalid =>
Comment:
Having encountered the same kind of issue while implemeting site-wide
custom AdminSite, I found a workaround to make it work.
It seems the documentation should be updated accordingly.
{{{
from django.contrib.admin.apps import AdminConfig
class MyAdminConfig(AdminConfig):
default_site = 'myproject.admin.MyAdminSite'
}}}
This raises an exception:
{{{RuntimeError: 'myproject.apps' declares more than one default
AppConfig: 'AdminConfig', 'MyAdminConfig'.}}}
It is solved by importing django.contrib.admin.apps instead of
django.contrib.admin.apps.AdminConfig:
{{{
from django.contrib.admin import apps
class MyAdminConfig(apps.AdminConfig):
default_site = 'myproject.admin.MyAdminSite'
}}}
Then the exception moves on:
{{{django.core.exceptions.ImproperlyConfigured: Application labels aren't
unique, duplicates: admin}}}
This is caused by the settings.py configuration:
{{{
INSTALLED_APPS = [
'myproject.apps.MyAdminConfig', #replaces django.contrib.admin
...
}}}
It is solved by removing the 'MyAdminConfig' from the settings:
{{{
INSTALLED_APPS = [
'myproject.apps', #replaces django.contrib.admin
...
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/32642#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.679113b3c271540ce15ad2f0c0e357d2%40djangoproject.com.