How to disable Django's invalid HTTP_HOST error?

前端 未结 11 915
日久生厌
日久生厌 2020-12-04 10:12

Ever since I deployed a site running Django 1.7 alpha (checked out from Git), I\'ve been occasionally receiving error messages with titles like:

\"Inv

11条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 11:14

    The django docs address this specifically. They recommend putting this in your logging settings

    LOGGING = {
        "handlers": {
            # ...
            "null": {
                "class": "logging.NullHandler",
            },
        },
        "loggers": {
            # ...
            "django.security.DisallowedHost": {
                "handlers": ["null"],
                "propagate": False,
            },
        },
    }
    

提交回复
热议问题