edge icon indicating copy to clipboard operation
edge copied to clipboard

null_technical_500_response() got an unexpected keyword argument 'status_code'

Open ghost opened this issue 9 years ago • 4 comments

Django: 1.10 Python: 2.7.9

After migrating and launching development server by ./manage.py runserver 0.0.0.0:8002 then visiting the page I receive this:

Traceback (most recent call last):
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
    response = self.get_response(request)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response
    response = self._middleware_chain(request)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = response_for_exception(request, exc)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 76, in response_for_exception
    response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)
TypeError: null_technical_500_response() got an unexpected keyword argument 'status_code'

Changed MIDDLEWARE_CLASSES to MIDDLEWARE in base.py, and added

MIDDLEWARE += [
    'debug_toolbar.middleware.DebugToolbarMiddleware',
]

to development.py file

and now I'm receiving:

Traceback (most recent call last):
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
    response = self.get_response(request)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response
    response = self._middleware_chain(request)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = response_for_exception(request, exc)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 86, in response_for_exception
    response = handle_uncaught_exception(request, get_resolver(get_urlconf()), sys.exc_info())
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 128, in handle_uncaught_exception
    return debug.technical_500_response(request, *exc_info)
  File "/home/rafal/csgopanel/src/csgopanel/wsgi.py", line 24, in null_technical_500_response
    six.reraise(exc_type, exc_value, tb)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/utils/deprecation.py", line 136, in __call__
    response = self.get_response(request)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = response_for_exception(request, exc)
  File "/home/rafal/.env/csgopanel/lib/python2.7/site-packages/django/core/handlers/exception.py", line 76, in response_for_exception
    response = debug.technical_500_response(request, *sys.exc_info(), status_code=400)
TypeError: null_technical_500_response() got an unexpected keyword argument 'status_code'

ghost avatar Nov 29 '16 21:11 ghost

Hi @rafalolszewskii ,

This is possibly due to issue #67 . This has been fixed in master. Please see my comments to that issue.

Thanks, Arun

arocks avatar Dec 07 '16 09:12 arocks

@arocks I'm still facing this issue with Python 3.5.2 .

pnhegde avatar Mar 20 '17 07:03 pnhegde

tks, still: Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in call response = self.get_response(request) File "/usr/lib/python2.7/site-packages/django/core/handlers/base.py", line 124, in get_response response = self._middleware_chain(request) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 41, in inner response = response_for_exception(request, exc) File "/usr/lib/python2.7/site-packages/django/core/handlers/exception.py", line 76, in response_for_exception response = debug.technical_500_response(request, *sys.exc_info(), status_code=400) TypeError: null_technical_500_response() got an unexpected keyword argument 'status_code'

chansonZ avatar May 04 '17 08:05 chansonZ

I faced the same problem and found a solution! ALLOWED_HOSTS seems to be necessary even if it's a debug mode.

I added below line to settings/development.py. Then debugging toolbar appeared! :)

ALLOWED_HOSTS = ["*"]

Drunkar avatar Aug 25 '17 08:08 Drunkar