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

'ProfilerMiddleware' object has no attribute 'profiler' #30

Open
AzikDeveloper opened this issue Nov 20, 2021 · 3 comments
Open

'ProfilerMiddleware' object has no attribute 'profiler' #30

AzikDeveloper opened this issue Nov 20, 2021 · 3 comments

Comments

@AzikDeveloper
Copy link

AzikDeveloper commented Nov 20, 2021

    def process_response(self, request, response):

        if self.can(request):

            self.profiler.create_stats()
@shypard
Copy link

shypard commented May 13, 2022

@omarish this error pops up every now and then, can you maybe have a look? Unfortunately I cannot get this 100% reproducable. However this PR looks promising: #23. - Thx :)

backend_1      | Traceback (most recent call last):
backend_1      |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
backend_1      |     response = get_response(request)
backend_1      |   File "/usr/local/lib/python3.9/site-packages/django/utils/deprecation.py", line 119, in __call__
backend_1      |     response = self.process_response(request, response)
backend_1      |   File "/usr/local/lib/python3.9/site-packages/django_cprofile_middleware/middleware.py", line 67, in process_response
backend_1      |     self.profiler.create_stats()
backend_1      | AttributeError: 'ProfilerMiddleware' object has no attribute 'profiler'
backend_1      | ERROR    [2022-05-13 08:37:44,458] django.request: Internal Server Error: /api/test
backend_1      | Traceback (most recent call last):
backend_1      |   File "/usr/local/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
backend_1      |     response = get_response(request)
backend_1      |   File "/usr/local/lib/python3.9/site-packages/django/utils/deprecation.py", line 119, in __call__
backend_1      |     response = self.process_response(request, response)
backend_1      |   File "/usr/local/lib/python3.9/site-packages/django_cprofile_middleware/middleware.py", line 67, in process_response
backend_1      |     self.profiler.create_stats()
backend_1      | AttributeError: 'ProfilerMiddleware' object has no attribute 'profiler'

@johnbridstrup
Copy link

Dang I was hoping this had an answer but I see nothing since 2021 😢

@ddrake
Copy link

ddrake commented Sep 28, 2023

I was seeing this error on every request with Django 4.2.5.

The changes in pull request #23 by ahumeao solved this issue for me.
I forked this repository, cloned the repo from my fork and pushed the modifications per the commit in pull request #23.

Then I installed from my fork like this:
pip install -e git+https://github.com/ddrake/django-cprofile-middleware.git#egg=django-cprofile-middleware
It has been working reliably for me since.

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

4 participants