0

我在 GAE 上的 Django 应用程序抛出了一个我无法理解的错误预热请求。当我手动输入www.mydomainname.com/_ah/warmup时,我收到 404 错误,但这是正常的。我应该从哪里开始调试?下面是错误信息。

E 2013-10-15 18:26:19.551
Internal Server Error: /_ah/warmup
Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/core/handlers/base.py", line 92, in get_response
    response = middleware_method(request)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/middleware/common.py", line 57, in process_request
    host = request.get_host()
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/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): 1.myappname.appspot.com

2013-10-15 18:26:22.030
Traceback (most recent call last):
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 266, in Handle
    result = handler(dict(self._environ), self._StartResponse)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/core/handlers/wsgi.py", line 255, in __call__
    response = self.get_response(request)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/core/handlers/base.py", line 178, in get_response
    response = self.handle_uncaught_exception(request, resolver, sys.exc_info())
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/core/handlers/base.py", line 224, in handle_uncaught_exception
    return callback(request, **param_dict)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/utils/decorators.py", line 91, in _wrapped_view
    response = view_func(request, *args, **kwargs)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/views/defaults.py", line 41, in server_error
    return http.HttpResponseServerError(template.render(Context({})))
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 140, in render
    return self._render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 134, in _render
    return self.nodelist.render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 830, in render
    bit = self.render_node(node, context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 844, in render_node
    return node.render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/loader_tags.py", line 124, in render
    return compiled_parent._render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 134, in _render
    return self.nodelist.render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 830, in render
    bit = self.render_node(node, context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 844, in render_node
    return node.render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/defaulttags.py", line 285, in render
    return nodelist.render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 830, in render
    bit = self.render_node(node, context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 844, in render_node
    return node.render(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/templatetags/cache.py", line 29, in render
    key = ':'.join([urlquote(resolve_variable(var, context)) for var in self.vary_on])
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 659, in resolve_variable
    return Variable(path).resolve(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 728, in resolve
    value = self._resolve_lookup(context)
  File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/django-1.5/django/template/base.py", line 771, in _resolve_lookup
    (bit, current))  # missing attribute
VariableDoesNotExist: Failed lookup for key [user] in u"[{'False': False, 'None': None, 'True': True}, {}]"
4

1 回答 1

2

在您的 settings.conf 文件中,您需要添加:

ALLOWED_HOSTS = ('.myappname.appspot.com',)

更多信息在这里: https ://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts

于 2014-01-01T18:19:56.183 回答