Django1.2/google-appengine debug "KeyError: 'REQUEST_METHOD" Error
Django1.2/google-appengine debug "KeyError: 'REQUEST_METHOD" Error
我有一个使用 Django 1.2 和 google-appengine
的 Python 2.7 项目。对于 运行 我键入 python main.py
的文件。这样做时,出现以下错误。我不熟悉 google-appengine
或 Django,不知道为什么会出现此错误。该项目还有一个名为 lib
的文件夹,其中有一个名为 appengine
的文件夹。我试图设置该文件夹的路径,但它似乎什么也没做。
Traceback (most recent call last):
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1595, in handle_exception
return handler(request, response, e)
File "/home/vicktree/Desktop/noah/web/noahs-app/handlers/hoptoad_handler.py", line 82, in handle_500_error
notify_hoptoad(exception, request, False, False)
File "/home/vicktree/Desktop/noah/web/noahs-app/handlers/hoptoad_handler.py", line 76, in notify_hoptoad
send_to_hoptoad(generate_xml(exn, request, debug_mode), use_ssl)
File "/home/vicktree/Desktop/noah/web/noahs-app/handlers/hoptoad_handler.py", line 34, in generate_xml
xml << ('url', request.url)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/request.py", line 495, in url
url = self.path_url
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/request.py", line 467, in path_url
bpath_info = bytes_(self.path_info, self.url_encoding)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/descriptors.py", line 70, in fget
return req.encget(key, encattr=encattr)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/request.py", line 153, in encget
raise KeyError(key)
KeyError: 'PATH_INFO'
ERROR:root:'REQUEST_METHOD'
Traceback (most recent call last):
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1546, in __call__
return response(environ, start_response)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/exc.py", line 358, in __call__
is_head = environ['REQUEST_METHOD'] == 'HEAD'
KeyError: 'REQUEST_METHOD'
Traceback (most recent call last):
File "main.py", line 1426, in <module>
main()
File "main.py", line 1423, in main
run_wsgi_app(application)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/ext/webapp/util.py", line 101, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/ext/webapp/util.py", line 119, in run_bare_wsgi_app
result = application(env, _start_response)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1548, in __call__
return self._internal_error(e)(environ, start_response)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/exc.py", line 358, in __call__
is_head = environ['REQUEST_METHOD'] == 'HEAD'
KeyError: 'REQUEST_METHOD'
我的问题:
我使用的 google-appengine
版本不正确吗(version=272.0.0)?
导致错误的具体原因是什么。我不明白REQUEST_METHOD
是什么意思
感谢您的宝贵时间。
当 运行 您的 Google App Engine 标准版(第一代)应用在本地时,您应该改用 dev_appserver.py
本地开发服务器。
有关详细信息,请参阅 https://cloud.google.com/appengine/docs/standard/python/tools/using-local-server。
我有一个使用 Django 1.2 和 google-appengine
的 Python 2.7 项目。对于 运行 我键入 python main.py
的文件。这样做时,出现以下错误。我不熟悉 google-appengine
或 Django,不知道为什么会出现此错误。该项目还有一个名为 lib
的文件夹,其中有一个名为 appengine
的文件夹。我试图设置该文件夹的路径,但它似乎什么也没做。
Traceback (most recent call last):
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1535, in __call__
rv = self.handle_exception(request, response, e)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1595, in handle_exception
return handler(request, response, e)
File "/home/vicktree/Desktop/noah/web/noahs-app/handlers/hoptoad_handler.py", line 82, in handle_500_error
notify_hoptoad(exception, request, False, False)
File "/home/vicktree/Desktop/noah/web/noahs-app/handlers/hoptoad_handler.py", line 76, in notify_hoptoad
send_to_hoptoad(generate_xml(exn, request, debug_mode), use_ssl)
File "/home/vicktree/Desktop/noah/web/noahs-app/handlers/hoptoad_handler.py", line 34, in generate_xml
xml << ('url', request.url)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/request.py", line 495, in url
url = self.path_url
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/request.py", line 467, in path_url
bpath_info = bytes_(self.path_info, self.url_encoding)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/descriptors.py", line 70, in fget
return req.encget(key, encattr=encattr)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/request.py", line 153, in encget
raise KeyError(key)
KeyError: 'PATH_INFO'
ERROR:root:'REQUEST_METHOD'
Traceback (most recent call last):
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1546, in __call__
return response(environ, start_response)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/exc.py", line 358, in __call__
is_head = environ['REQUEST_METHOD'] == 'HEAD'
KeyError: 'REQUEST_METHOD'
Traceback (most recent call last):
File "main.py", line 1426, in <module>
main()
File "main.py", line 1423, in main
run_wsgi_app(application)
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/ext/webapp/util.py", line 101, in run_wsgi_app
run_bare_wsgi_app(add_wsgi_middleware(application))
File "/usr/lib/google-cloud-sdk/platform/google_appengine/google/appengine/ext/webapp/util.py", line 119, in run_bare_wsgi_app
result = application(env, _start_response)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webapp2.py", line 1548, in __call__
return self._internal_error(e)(environ, start_response)
File "/home/vicktree/.local/share/virtualenvs/noahs-app-M81YxnJh/local/lib/python2.7/site-packages/webob/exc.py", line 358, in __call__
is_head = environ['REQUEST_METHOD'] == 'HEAD'
KeyError: 'REQUEST_METHOD'
我的问题:
我使用的
google-appengine
版本不正确吗(version=272.0.0)?导致错误的具体原因是什么。我不明白
REQUEST_METHOD
是什么意思
感谢您的宝贵时间。
当 运行 您的 Google App Engine 标准版(第一代)应用在本地时,您应该改用 dev_appserver.py
本地开发服务器。
有关详细信息,请参阅 https://cloud.google.com/appengine/docs/standard/python/tools/using-local-server。