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

前端 未结 1 2003
天命终不由人
天命终不由人 2021-01-17 16:32

I keep getting the below errors in my sentry exceptions

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

And th

1条回答
  •  执笔经年
    2021-01-17 17:09

    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.

    0 讨论(0)
提交回复
热议问题