[Django]-FutureWarning: `TemplateForHostMiddleware` is deprecated. Please upgrade to the template loader

3đź‘Ť

âś…

See this portion of the documentation which explains what is going on:

Mezzanine implements host-specific templates using a template loader since version 4.3. Prior to that, the TemplateForHostMiddleware was used. If you are upgrading from a version lower than 4.3 and getting warnings in the terminal about TemplateForHostMiddleware, edit your settings.py to switch to the new loader-based approach:

  • Remove TemplateForHostMiddleware from your MIDDLEWARE or MIDDLEWARE_CLASSES setting.
  • Remove "APP_DIRS": True from your TEMPLATES setting.
  • Add mezzanine.template.loaders.host_themes.Loader to the list of template loaders.

Your TEMPLATES setting should look like this (notice the “loaders” key):

TEMPLATES = [
  {
      "BACKEND": "django.template.backends.django.DjangoTemplates",
      "DIRS": [...],
      "OPTIONS": {
          "context_processors": [...],
          "builtins": [...],
          "loaders": [
              "mezzanine.template.loaders.host_themes.Loader",
              "django.template.loaders.filesystem.Loader",
              "django.template.loaders.app_directories.Loader",
          ]
      },
  },
]

Looks like this change to the documentation hasn’t made it to http://mezzanine.jupo.org/docs/multi-tenancy.html .

👤solarissmoke

Leave a comment