I faced the same problems. And I make the system send an error message to my gmail:
SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): 127.0.0.1:8000
So, I am adding this code to settings.py:
ALLOWED_HOSTS = ['127.0.0.1', 'localhost']
And now, everything is in order. I think that when you make DEBUG and TEMPLATE_DEBUG false, you should set ALLOWED_HOSTS.
Good luck.
Ni Xiaoni
source share