Django runserver error "TypeError: __init__() takes 1 positional argument but 2 were given"

170 views Asked by At

I understand that somewhere 2 parameters are passed when 1 is needed only, but I can't seem to figure out where.

I was in the process of updating Django from 1.9 to 1.11.

Most answers relate to views, but all my views are class based and had as_view already.

the exact traceback is:

Traceback (most recent call last):
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
    fn(*args, **kwargs)
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/mezzanine/core/management/commands/runserver.py", line 163, in inner_run
    super(Command, self).inner_run(*args, **kwargs)
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 146, in inner_run
    handler = self.get_handler(*args, **options)
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/mezzanine/core/management/commands/runserver.py", line 166, in get_handler
    handler = super(Command, self).get_handler(*args, **options)
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 28, in get_handler
    handler = super(Command, self).get_handler(*args, **options)
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 67, in get_handler
    return get_internal_wsgi_application()
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/servers/basehttp.py", line 47, in get_internal_wsgi_application
    return import_string(app_path)
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/utils/module_loading.py", line 20, in import_string
    module = import_module(module_path)
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/pp/www/Hakomo/hakomo/hakomo/wsgi.py", line 20, in <module>
    application = get_wsgi_application()
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
    return WSGIHandler()
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/handlers/wsgi.py", line 151, in __init__
    self.load_middleware()
  File "/Users/pp/.pyenv/versions/3.7.13/lib/python3.7/site-packages/django/core/handlers/base.py", line 82, in load_middleware
    mw_instance = middleware(handler)
TypeError: __init__() takes 1 positional argument but 2 were given

The only file not from a package/lib is wsgi.py which equivalent to the stock wsgi when you do a startproject when using Django 1.11

import os

from django.core.wsgi import get_wsgi_application
from mezzanine.utils.conf import real_project_name

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hakomo.settings")

application = get_wsgi_application()

So I am having trouble understanding where exactly is this coming from. I would appreciate any insights, thanks!

0

There are 0 answers