我已经为我的 django 应用程序安装了哨兵,并且刚刚从 debug=True 切换到 False。自从我进行此更改以来,我每 10 分钟左右记录一次错误。
这是完整的错误:
Traceback (most recent call last):
File "/home/ubuntu/postalenv/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 92, in get_response
response = middleware_method(request)
File "/home/ubuntu/postalenv/local/lib/python2.7/site-packages/django/middleware/common.py", line 57, in process_request
host = request.get_host()
File "/home/ubuntu/postalenv/local/lib/python2.7/site-packages/django/http/request.py", line 72, in get_host
"Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): %s" % host)
SuspiciousOperation: Invalid HTTP_HOST header (you may need to set ALLOWED_HOSTS): localhost
在我的 allowed_hosts 中,我包含了我的域名。知道这是什么原因造成的吗?