title: django middleware error with middleware takes no argument
body: <p>I have been encountering this error since and I have checked Django docs and search many sites through google but still don't get the solution to this error, thanks in advance. this error comes whenever I want run server   </p>
  
  <pre class="lang-py prettyprint-override"><code>from datetime import timedelta
  
  from django.core.cache import cache
  from django.utils import translation, timezone
  from django.conf import settings as global_settings
  import pytz
  from djangobb_forum import settings as forum_settings
  
  class TimezoneMiddleware(object):
      def process_request(self, request):
          if request.user.is_authenticated():
              profile = request.user.forum_profile
              try:
                  timezone.activate(profile.time_zone)
              except pytz.UnknownTimeZoneError:
                  profile.time_zone = global_settings.TIME_ZONE
                  profile.save()
  </code></pre>
  
  <p><strong>this is my middleware in settings.py,am using python 3.7 and Django 2.2</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>MIDDLEWARE = [
      'django.middleware.security.SecurityMiddleware',
      'django.contrib.sessions.middleware.SessionMiddleware',
      'django.middleware.common.CommonMiddleware',
      'django.middleware.csrf.CsrfViewMiddleware',
      'django.contrib.auth.middleware.AuthenticationMiddleware',
      'django.contrib.messages.middleware.MessageMiddleware',
      'django.middleware.clickjacking.XFrameOptionsMiddleware',
  
          #DjangoBB_Forum part
      'django.middleware.cache.UpdateCacheMiddleware',
      'django.middleware.locale.LocaleMiddleware',
      'pagination.middleware.PaginationMiddleware',
      'django.middleware.cache.FetchFromCacheMiddleware',
      'djangobb_forum.middleware.LastLoginMiddleware',
      'djangobb_forum.middleware.UsersOnline',
      'djangobb_forum.middleware.TimezoneMiddleware',
  ]
  </code></pre>
  
  <p><strong>this is the error am getting</strong></p>
  
  <pre><code>System check identified 48 issues (0 silenced).
  April 21, 2019 - 00:34:43
  Django version 2.2, using settings 'hayhealth_v_2.settings'
  Starting development server at http://127.0.0.1:8000/
  Quit the server with CTRL-BREAK.
  Exception in thread Thread-1:
  Traceback (most recent call last):
      File "c:\users\hay square\appdata\local\programs\python\python37-32\Lib\threading.py", line 917, in _bootstrap_inner
      self.run()
      File "c:\users\hay square\appdata\local\programs\python\python37-32\Lib\threading.py", line 865, in run
      self._target(*self._args, **self._kwargs)
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\utils\autoreload.py", line 54, in wrapper
      fn(*args, **kwargs)
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\core\management\commands\runserver.py", line 137, in inner_run
      handler = self.get_handler(*args, **options)
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\contrib\staticfiles\management\commands\runserver.py", line 27, in get_handler
      handler = super().get_handler(*args, **options)
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\core\management\commands\runserver.py", line 64, in get_handler
      return get_internal_wsgi_application()
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\core\servers\basehttp.py", line 45, in get_internal_wsgi_application
      return import_string(app_path)
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\utils\module_loading.py", line 17, in import_string
      module = import_module(module_path)
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\importlib\__init__.py", line 127, in import_module
      return _bootstrap._gcd_import(name[level:], package, level)
      File "&lt;frozen importlib._bootstrap&gt;", line 1006, in _gcd_import
      File "&lt;frozen importlib._bootstrap&gt;", line 983, in _find_and_load
      File "&lt;frozen importlib._bootstrap&gt;", line 967, in _find_and_load_unlocked
      File "&lt;frozen importlib._bootstrap&gt;", line 677, in _load_unlocked
      File "&lt;frozen importlib._bootstrap_external&gt;", line 728, in exec_module
      File "&lt;frozen importlib._bootstrap&gt;", line 219, in _call_with_frames_removed
      File "C:\Users\hay square\Desktop\New folder (6)\all projects\hayhealth\hayhealth\hayhealth_v_2\wsgi.py", line 16, in &lt;module&gt;
      application = get_wsgi_application()
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\core\wsgi.py", line 13, in get_wsgi_application
      return WSGIHandler()
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\core\handlers\wsgi.py", line 135, in __init__
      self.load_middleware()
      File "C:\Users\HAYSQU~1\Desktop\NE86E9~1\ALLPRO~1\HAYHEA~1\HAYHEA~1\lib\site-packages\django\core\handlers\base.py", line 37, in load_middleware
      mw_instance = middleware(handler)
  TypeError: TimezoneMiddleware() takes no arguments
  </code></pre>