-
Notifications
You must be signed in to change notification settings - Fork 246
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: 'Response' object has no attribute 'template_name' #54
Comments
Interesting. I'm not familiar with cache_page so before I fix I should ask - do you think ignoring the request in responses_by_templatename is the best way to go here? Should we account them to something like template="<unknown_template>" instead? |
Yeah, that's probably better so at least the views are included in the metrics. |
Same error here, sadly I can't use this awesome project in my application due to this bug and #42. Django 2.0.2 |
same error Django 1.11.10 |
Using django-prometheus 1.0.9 with django 1.11.2.
I have some django-rest-framework views that are being cached with the cache_page decorator like:
When there is a cache hit, the django-prometheus middleware fails in middleware.py:135 with AttributeError: 'Response' object has no attribute 'template_name'
Sure enough, the cached views don't seem to have template_name. I fixed it by checking for the attribute first, not sure if that's the best way but it works for me:
The text was updated successfully, but these errors were encountered: