Opened 12 years ago

Closed 12 years ago

#18109 closed Uncategorized (invalid)

Page Stats Middleware break the admin site

Reported by: Pablo Catalina Owned by: nobody
Component: Generic views Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The Page Stats Middleware from: https://code.djangoproject.com/wiki/PageStatsMiddleware break the admin site with the error:

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/

Django Version: 1.4
Python Version: 2.7.2
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'djangomiddlewares.middleware.StatsMiddleware')


Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
  105.                         response = middleware_method(request, callback, callback_args, callback_kwargs)
File "/usr/local/src/djangomiddlewares/middleware.py" in process_view
  57.         if response and response.content:
File "/usr/local/lib/python2.7/dist-packages/django/template/response.py" in _get_content
  123.             raise ContentNotRenderedError('The response content must be '

Exception Type: ContentNotRenderedError at /admin/
Exception Value: The response content must be rendered before it can be accessed.

I make a "temporal" adding:

        if request.path.startswith('/admin/'):
            return None

But I think the problem must break other things.

Change History (1)

comment:1 by Aymeric Augustin, 12 years ago

Resolution: invalid
Status: newclosed

The wiki is a community resource, and the StatsMiddleware is a third party add-on, not officially supported by the Django project.

You should report the problem to the djangomiddlewares project, and maybe edit the wiki to mention this problem.

Note: See TracTickets for help on using tickets.
Back to Top