当debug = False时,错误的请求400

时间:2015-12-07 09:30:11

标签: python django http-status-code-400 cookiecutter

当我设置debug = false时,我遇到“Bad Request 400”(生产服务器)的问题。我使用cookiecutter和Django 1.8。 我设置ALLOWED_HOSTS = ['*'] - 没有任何结果。

在日志中,我有一条消息:

Invalid HTTP_HOST header: 'myaddress.here'. You may need to add 'myaddress.here' to ALLOWED_HOSTS.

我尝试了文档django中的代码,也没有成功:

'handlers': {
    'null': {
        'class': 'logging.NullHandler',
    },
},
'loggers': {
    'django.security.DisallowedHost': {
        'handlers': ['null'],
        'propagate': False,
    },
},

1 个答案:

答案 0 :(得分:0)

您是否尝试过ALLOWED_HOSTS = [' *',' yourdomain.com',' www.yourdomain.com',' 123.456.78.91 '?]

相关问题