5

I have updated to django 1.5 and am getting the following message:

SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): localhost:8000

I have tried localhost, 127.0.0.1, localhost:8000 in ALLOWED_HOSTS. I have also tried ['*'] all without success.

Anybody any ideas where I am going wrong? Works as expected with DEBUG=False

Mathew
  • 379
  • 2
  • 12
  • 3
    Give a try to `ALLOWED_HOSTS = ['localhost', '127.0.0.1']`. Hope that helps. – alecxe Jun 13 '13 at 17:49
  • 1
    What about a string: `ALLOWED_HOSTS = "*"` – aemdy Jun 13 '13 at 18:16
  • Thanks both for responses, I have tried and just retried both the suggestions without success, I get the same suspiciousoperation. I am thinking that if "*" does not work then there must be something configured incorrectly elsewhere? – Mathew Jun 14 '13 at 08:12
  • Please note that contrary to @alecxe comment above ``localhost`` will not work in ``ALLOWED_HOSTS`` - see regex for host sanity check https://github.com/django/django/blob/58d555caf527d6f1bdfeab14527484e4cca68648/django/http/request.py#L27 – bmihelac Oct 10 '13 at 08:53

1 Answers1

0

Resolved. I had deploy settings in a different file overriding the allowed_hosts in settings.py. Appologies missed this before posting. Thanks for the responses received.

Mathew
  • 379
  • 2
  • 12