django 400 Bad Request code example Example 1: avoid bad request django ALLOWED_HOSTS = ['127.0.0.1', 'localhost'] Example 2: avoid bad request django ALLOWED_HOSTS = ['*']