I am building a mezzanine website.
I installed mezzanine by typing pip install mezzanine
this installed django 1.9 (IIRC) along with mezzanine.
I then installed cartridge, which upgraded django to version 1.10.8.
Now when I run runserver
at the command line, I get the following warning at the command line:
/path/to/env/lib/python3.5/site-packages/django/core/handlers/base.py:58: FutureWarning: TemplateForHostMiddleware` is deprecated. Please upgrade to the template loader.
How do I resolve this warning - as the warning is not very clear (i.e. upgrade which template loader and also, what does it mean to upgrade the template loader?)
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 aboutTemplateForHostMiddleware
, edit your settings.py to switch to the new loader-based approach:
- Remove
TemplateForHostMiddleware
from yourMIDDLEWARE
orMIDDLEWARE_CLASSES
setting.- Remove
"APP_DIRS": True
from yourTEMPLATES
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 .