wq / django-data-wizard

🧙⚙️ Import structured data (e.g. Excel, CSV, XML, JSON) into one or more Django models via an interactive web-based wizard
https://django-data-wizard.wq.io
MIT License
341 stars 53 forks source link

Upon installation admin interface error: Reverse for 'app_list' not found. 'app_list' is not a valid view function or pattern name. #27

Closed dirkjankrijnders closed 4 years ago

dirkjankrijnders commented 4 years ago

Hi,

I just installed django-data-wizard to try it out according to the README.md. However as soon as I add data_wizard to my INSTALLED_APPS I get the error below when trying to access /admin. This is running the latest version from git, but I also tried the pypi version and I tried django 2.2.6. All with the same result? Did I miss something? Where do I start looking? Thanks,

Dirkjan

Environment:

Request Method: GET
Request URL: http://localhost:8000/admin/

Django Version: 3.0.2
Python Version: 3.7.3
Installed Applications:
['catalogitem.apps.CatalogitemConfig',
 'viewer.apps.ViewerConfig',
 'import_export',
 'data_wizard',
 'data_wizard.sources',
 'markdown_deux',
 'crispy_forms',
 'pagedown',
 'leaflet',
 'rest_framework',
 'location_field.apps.DefaultConfig',
 'django_filters',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']

Traceback (most recent call last):
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 249, in wrapper
    return self.admin_view(view, cacheable)(*args, **kwargs)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/utils/decorators.py", line 130, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 231, in inner
    return view(request, *args, **kwargs)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 499, in index
    app_list = self.get_app_list(request)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 482, in get_app_list
    app_dict = self._build_app_dict(request)
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 467, in _build_app_dict
    current_app=self.name,
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/urls/base.py", line 87, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File "/home/dirkjan/Projects/rostma-docker/rostma/venv/lib/python3.7/site-packages/django/urls/resolvers.py", line 677, in _reverse_with_prefix
    raise NoReverseMatch(msg)

Exception Type: NoReverseMatch at /admin/
Exception Value: Reverse for 'app_list' not found. 'app_list' is not a valid view function or pattern name.
sheppard commented 4 years ago

At first glance, it's not clear that this is a bug with data wizard. Is admin.site.urls included in your urls.py?

sheppard commented 4 years ago

Hmm, it looks like this can happen if "data_wizard" is listed before "django.contrib.admin" in INSTALLED_APPS.

sheppard commented 4 years ago

Ok, there was a urlconf check in data_wizard.apps.WizardConfig that was interfering with the admin (but only if data_wizard was listed first). The check is not really needed anymore so I removed it and the order now does not matter.

dirkjankrijnders commented 4 years ago

That fixed it indeed. I just tested with the latest code from git and the installation was flawless. Thanks for looking into it.