I've just upgraded to Django 1.5, and when I try and access a page, I get the following error:
ImproperlyConfigured: Error importing middleware app.middleware: "cannot import name get_host"
In the shell, I try a similar thing:
>>> 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
It's failing on the import of get_host
. It doesn't seem that this is deprecated, what's going on?
In Django 1.5 django.http.get_host()
is replaced with request.get_host()
. See the methods on HttpRequest
object here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With