ecometrica / django-multisite

Multisite in django — use one Django app to serve multiple domains
BSD 3-Clause "New" or "Revised" License
138 stars 42 forks source link

Django 1.10 middleware fails #37

Closed 36rahu closed 7 years ago

36rahu commented 7 years ago

Facing an issue while adding multisite.middleware.DynamicSiteMiddleware in MIDDLEWARE . I hope need to update the middleware according to django 1.10.

Here is my traceback.

Traceback (most recent call last):
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
    fn(*args, **kwargs)
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 142, in inner_run
    handler = self.get_handler(*args, **options)
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/contrib/staticfiles/management/commands/runserver.py", line 27, in get_handler
    handler = super(Command, self).get_handler(*args, **options)
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 64, in get_handler
    return get_internal_wsgi_application()
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 49, in get_internal_wsgi_application
    return import_string(app_path)
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 20, in import_string
    module = import_module(module_path)
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/rahul/Projects/multisite/uniserved_multisite/uniserved_multisite/wsgi.py", line 16, in <module>
    application = get_wsgi_application()
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
    return WSGIHandler()
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 153, in __init__
    self.load_middleware()
  File "/home/rahul/virtulenv_files/multisite/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 82, in load_middleware
    mw_instance = middleware(handler)
TypeError: __init__() takes exactly 1 argument (2 given)

Ref : https://docs.djangoproject.com/en/1.10/topics/http/middleware/#upgrading-pre-django-1-10-style-middleware

kousu commented 7 years ago

Hello @36rahu, thanks for taking the time to report this. We are currently in the process of upgrading to Django 1.10. I hadn't discovered this issue yet. I am going to down update django-multisite systematically, but unfortunately, we have other pieces that have higher priority for us currently. PRs welcome, or if not, patience.

Thanks!

kousu commented 7 years ago

Fixed in #38. Thank you for the report, again.