Django ImportError: Module does not define attribute/class

  django, importerror, python

I am trying to add a custom/overridden AdminSite because I need a different template for the Admin. I did everything as the Docs said:
https://docs.djangoproject.com/en/3.0/ref/contrib/admin/#customizing-the-adminsite-class

class NewAdminSite(AdminSite):
    index_template = 'admin/index.html'
    site_header = 'Administration'

admin_site = NewAdminSite(name='newadmin')

ofc I added admin_site.urls instead of admin.site.urls to urls.py, created a custom AdminConfig in apps.py, and added that new AdminConfig to installed Apps instead of django.contrib.admin.

The Problem is that I now receive this:

AdminSiteClass = import_string(apps.get_app_config(‘admin’).default_site)

File "C:UsersUser.virtualenvsssccms-fGQRLLK4libsite-packagesdjangoutilsmodule_loading.py", line 24, in import_string
) from err

ImportError: Module "project.admin" does not define a "NewAdminSite" attribute/class

Source: Python Questions

LEAVE A COMMENT