django-debug-toolbar: ImproperlyConfigured: The included urlconf project.urls doesn't have any patterns in it (via patch_root_urlconf)

patch_root_urlconf appears to cause an ImproperlyConfigured error for me:

The included urlconf project.urls doesn't have any patterns in it

This happens after adding debug_toolbar to INSTALLED_APPS.

From the traceback it looks like the admin autodiscover triggers invocation of DDT’s patching, but the project urlconf is still empty at that point.

apps/project/urls.py looks as follows:

# imports and autocomplete_light setup
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns(
    '',
    (r'^grappelli/', include('grappelli.urls')),
    url(r'^admin/', include(admin.site.urls)),

    # …
)

This does not happen with DDT 0.10.2.

I have also tried / are currently DDT master.

Django Version: 1.6.2.dev20140104173735

Traceback:
File "/home/daniel/src/django-stable/django/core/handlers/base.py" in get_response
  101.                 resolver_match = resolver.resolve(request.path_info)
File "/home/daniel/src/django-stable/django/core/urlresolvers.py" in resolve
  318.             for pattern in self.url_patterns:
File "/home/daniel/src/django-stable/django/core/urlresolvers.py" in url_patterns
  346.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/daniel/src/django-stable/django/core/urlresolvers.py" in urlconf_module
  341.             self._urlconf_module = import_module(self.urlconf_name)
File "/home/daniel/src/django-stable/django/utils/importlib.py" in import_module
  40.         __import__(name)
File "/home/daniel/projects/tmm/apps/project/urls.py" in <module>
  15. admin.autodiscover()
File "/home/daniel/src/django-stable/django/contrib/admin/__init__.py" in autodiscover
  29.             import_module('%s.admin' % app)
File "/home/daniel/src/django-stable/django/utils/importlib.py" in import_module
  40.         __import__(name)
File "/home/daniel/src/django-stable/django/contrib/auth/admin.py" in <module>
  182. admin.site.register(Group, GroupAdmin)
File "/home/daniel/src/django-stable/django/contrib/admin/sites.py" in register
  92.                     admin_class.validate(model)
File "/home/daniel/src/django-stable/django/contrib/admin/options.py" in validate
  105.         validator = cls.validator_class()
File "/home/daniel/src/django-stable/django/contrib/admin/validation.py" in __init__
  20.         models.get_apps()
File "/home/daniel/src/django-stable/django/db/models/loading.py" in get_apps
  139.         self._populate()
File "/home/daniel/src/django-stable/django/db/models/loading.py" in _populate
  75.                 self.load_app(app_name, True)
File "/home/daniel/src/django-stable/django/db/models/loading.py" in load_app
  99.             models = import_module('%s.models' % app_name)
File "/home/daniel/src/django-stable/django/utils/importlib.py" in import_module
  40.         __import__(name)
File "/home/daniel/.virtualenvs/tmm/src/django-debug-toolbar/debug_toolbar/models.py" in <module>
  63.     patch_root_urlconf()
File "/home/daniel/.virtualenvs/tmm/src/django-debug-toolbar/debug_toolbar/models.py" in patch_root_urlconf
  51.         reverse('djdt:render_panel')
File "/home/daniel/src/django-stable/django/core/urlresolvers.py" in reverse
  480.                 app_list = resolver.app_dict[ns]
File "/home/daniel/src/django-stable/django/core/urlresolvers.py" in app_dict
  310.             self._populate()
File "/home/daniel/src/django-stable/django/core/urlresolvers.py" in _populate
  262.         for pattern in reversed(self.url_patterns):
File "/home/daniel/src/django-stable/django/core/urlresolvers.py" in url_patterns
  350.             raise ImproperlyConfigured("The included urlconf %s doesn't have any patterns in it" % self.urlconf_name)

Exception Type: ImproperlyConfigured at /
Exception Value: The included urlconf project.urls doesn't have any patterns in it

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 17 (7 by maintainers)

Commits related to this issue

Most upvoted comments

I’ve spent way too much unpaid time attempting to fix this.

Feel free to submit a pull request.

When you re-installed your environment, you got the latest version.

You might want to pin your dependencies 😉

Yes, but that’s not enough, you also have to set up the Debug Toolbar explicitly.

In short: read the docs 😉