Django Book 翻译
菜单>:
TOC
返回
原文:
Once youve created redirects, the ``RedirectFallbackMiddleware`` class does all of the work. Each time any Django application raises a 404 error, this middleware checks the redirects database for the requested URL as a last resort. Specifically, it checks for a redirect with the given ``old_path`` with a site ID that corresponds to the ``SITE_ID`` setting. (See the earlier section Sites for more information on ``SITE_ID`` and the sites framework.) Then it follows these steps:
翻译:
一旦创建了重定向, ``RedirectFallbackMiddleware`` 类将完成所有的工作。每当 Django 应用引发一个 404 错误,作为终极手段,该中间件将为所请求的 URL 在重定向数据库中进行查找。确切地说,它将使用给定的 ``old_path`` 以及 ``SITE_ID`` 设置对应的站点 ID 查找重定向设置。(查阅前面的《多站点》一节可了解关于 ``SITE_ID`` 和多站点框架的更多细节) 然后,它将执行以下两个步骤:
备注:
译者: