Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'django.views.debug' has no attribute 'CURRENT_DIR' #399

Closed
rishindoshi opened this issue Jan 6, 2022 · 10 comments
Closed

Comments

@rishindoshi
Copy link

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!

@ezarowny
Copy link
Contributor

ezarowny commented Jan 6, 2022

@rishindoshi what are you defining BASE_DIR as? Also, do you have a custom 500 page and, if so, how is it configured?

@rishindoshi
Copy link
Author

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.

@ezarowny
Copy link
Contributor

ezarowny commented Jan 7, 2022

@rishindoshi Django version and pyrollbar version??

@rishindoshi
Copy link
Author

@ezarowny Django version 4.0 and rollbar version 0.16.2

@ezarowny
Copy link
Contributor

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.

@ezarowny
Copy link
Contributor

Okay, I was able to replicate this. I'll see if I can figure out what's going on.

@ezarowny
Copy link
Contributor

@rishindoshi
Copy link
Author

@ezarowny Thanks for looking into this again! Lmk if I can provide any more info for you

@ezarowny
Copy link
Contributor

#400 might do it

@danielmorell
Copy link
Collaborator

Closing because it appears this has already been fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants