我刚刚升级到 Django 1.5,当我尝试访问页面时,出现以下错误:
ImproperlyConfigured: Error importing middleware app.middleware: "cannot import name get_host"
在 shell 中,我尝试了类似的事情:
>>> from app import middleware
Traceback (most recent call last):
File "<console>", line 1, in <module>
File ".../middleware.py", line 2, in <module>
from django.http import HttpResponseRedirect, HttpResponsePermanentRedirect, get_host
ImportError: cannot import name get_host
导入失败get_host
。这似乎没有被弃用,这是怎么回事?