我正在构建一个 mezzanine网站。
我通过键入 pip install mezzanine 安装了 mezzanine,这安装了 django 1.9 (IIRC) 和 mezzanine。
然后我安装了cartridge , 将 django 升级到 1.10.8 版本。
现在,当我在命令行运行 runserver 时,我在命令行收到以下警告:
/path/to/env/lib/python3.5/site-packages/django/core/handlers/base.py:58: FutureWarning: TemplateForHostMiddleware` is deprecated. Please upgrade to the template loader.
我该如何解决此警告 - 因为警告不是很清楚(即升级哪个 模板加载器以及升级模板加载器是什么意思? )
请您参考如下方法:
参见 this portion解释正在发生的事情的文档:
Mezzanine implements host-specific templates using a template loader since version 4.3. Prior to that, the
TemplateForHostMiddlewarewas 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
TemplateForHostMiddlewarefrom yourMIDDLEWAREorMIDDLEWARE_CLASSESsetting.- Remove
"APP_DIRS": Truefrom yourTEMPLATESsetting.- Add
mezzanine.template.loaders.host_themes.Loaderto 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", ] }, }, ]
看起来对文档的这种更改还没有实现 http://mezzanine.jupo.org/docs/multi-tenancy.html .
