AttributeError: module 'django.views.debug' has no attribute 'CURRENT_DIR'
rishindoshi opened this issue · 10 comments
Hello! I have a Django application hooked up to Rollbar, but when server errors occur, there seems to be some errors in the Rollbar library code that also get dumped and produce quite a bit of noise.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/wsgiref/handlers.py", line 137, in run
self.result = application(self.environ, self.start_response)
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/django/contrib/staticfiles/handlers.py", line 76, in __call__
return self.application(environ, start_response)
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/django/core/handlers/wsgi.py", line 133, in __call__
response = self.get_response(request)
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/django/core/handlers/base.py", line 130, in get_response
response = self._middleware_chain(request)
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/django/core/handlers/exception.py", line 49, in inner
response = response_for_exception(request, exc)
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/django/core/handlers/exception.py", line 110, in response_for_exception
response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/django/core/handlers/exception.py", line 145, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/django/views/debug.py", line 65, in technical_500_response
html = reporter.get_traceback_html()
File "/Users/rishdosh/.local/share/virtualenvs/discz-backend-35FI4fIx/lib/python3.9/site-packages/rollbar/contrib/django/middleware.py", line 148, in new_get_traceback_html
with Path(debug.CURRENT_DIR, 'templates', 'technical_500.html').open() as fh:
AttributeError: module 'django.views.debug' has no attribute 'CURRENT_DIR'
For each error that happens in my application, the above error from Rollbar is logged multiple times and makes it quite difficult to sift through logs to find the application error.
My ROLLBAR
config is set to:
ROLLBAR = {
'access_token': '<token>',
'environment': 'development',
'root': str(BASE_DIR),
}
Any help on this would be much appreciated!
@rishindoshi what are you defining BASE_DIR as? Also, do you have a custom 500 page and, if so, how is it configured?
Hey @ezarowny my BASE_DIR
is defined as BASE_DIR = Path(__file__).resolve().parent.parent
which resolves to my project root directory. I do not have a custom 500 page.
@rishindoshi Django version and pyrollbar version??
@ezarowny Django version 4.0 and rollbar version 0.16.2
I haven't had a chance to upgrade our app to Django 4.0 yet (we're only one version behind though) but I'll pop back here in when I do because I'll likely run into the same problem.
Okay, I was able to replicate this. I'll see if I can figure out what's going on.
Here's the relevant change from Django: django/django@9ee693b#diff-eb948fbc65f2117752334d2fc61d04bfbb635aa3d91f7e1b652376efea04e658
@ezarowny Thanks for looking into this again! Lmk if I can provide any more info for you