parser.yaml
application: xyz
module: parser
version: 'v1'
runtime: python27
api_version: '1'
threadsafe: yes
instance_class: B2
basic_scaling:
max_instances: 1
idle_timeout: 10m
handlers:
- url: /.*
script: parser.app
libraries:
- name: webapp2
version: "2.5.2"
parser.py
import webapp2
class ParseHandler(webapp2.RequestHandler):
def get(self):
self.response.out.write("ok")
app = webapp2.WSGIApplication([
('/init', ParseHandler)
], debug=True)
Google App Engines请求/ _ah / start返回错误(代码500):
"GET /_ah/start HTTP/1.1" 500 0 - - "0.v1.parser.xyz.appspot.com" ms=332 cpu_ms=27 loading_request=1 exit_code=111 instance=0 app_engine_release=1.8.9
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 239, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 301, in _LoadHandler
raise err
ImportError: <module 'parser' (built-in)> has no attribute app
This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.
Process terminated because it failed to respond to the start request with an HTTP status code of 200-299 or 404.
但是parser.py具有所需的app属性。问题是什么?
我尝试为/ _ah / start添加一个专用路由,并在parser.py中为它添加了一个处理程序,但这并没有解决ImportError。
答案 0 :(得分:3)
应用引擎似乎找到了内置解析器模块;一个C库。
尝试将模块从parser.py
重命名为其他内容。