我正在将旧的 Django
项目迁移到 Django 2.0
。在其中一个 View 文件中,我遇到了一个 import
语句:
from django.core.xheaders import populate_xheaders
我正在尝试找出这个包的替代方案 - 既不在 google 中也不在 stackoverflow 中。
谁能帮我找到替代包?
最佳答案
django.core.xheaders
在 Django 1.6 中被移除。以下消息在删除后添加到文档中:
The
django.contrib.flatpages
app used to set custom HTTP headers for debugging purposes. This functionality was not documented and made caching ineffective so it has been removed, along with its generic implementation, previously available indjango.core.xheaders
.
我怀疑您可以在您正在移植的应用程序中删除对此函数的调用。
如果您确实需要这些 header ,您可以从 the commit where it was removed 复制功能.
有关最初创建此函数的原因的信息,请参阅 the ticket that tracked its addition .
关于python - Django 2.0 中 "django.core.xheaders"的替代 Django 包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49388994/