AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'
Asked Answered
S

1

10

I keep getting the below errors in my sentry exceptions

AttributeError: 'RegexURLResolver' object has no attribute '_urlconf_module'

And the trace only points to code withing the django code base without pointing to any place in my application. My logs are clean too. What could be a possible reason for this?

        raise Resolver404({'path' : path})
     @property
     def urlconf_module(self):
         try:
             return self._urlconf_module
         except AttributeError:
             self._urlconf_module = import_module(self.urlconf_name)
             return self._urlconf_module
     @property
'self'  
<RegexURLResolver urls (None:None) ^/>
Sporozoite answered 22/6, 2013 at 21:37 Comment(2)
Looks like you are invoking the regexresolver of a class before it is initialized. It could be a dependancy issue.Fleshly
Can you elaborate? I haven't changed anything relevant to urls and this error started appearing. Any idea how I can go about debugging this?Sporozoite
H
2

Otherwise on the Internet I found this:

The issue is caused by an import ordering problem, in your example code you call urlresolvers.reverse which will load example/urls.py, which will trigger an admin.autodiscover() call, which will load social/apps/django_app/default/admin.py, which will try to load your custom user model which will fail to load your user model.

I hit the problem when I called a function directly from views.py, and this function resulted in use of resolve, which probably lead to an import problem since calling a function directly from views.py is bad style. However, the comment above helped med debug the issue.

Hyson answered 11/11, 2015 at 20:15 Comment(1)
You probably found it here: github.com/omab/python-social-auth/issues/269Bundestag

© 2022 - 2024 — McMap. All rights reserved.