gpt4 book ai didi

python - Google App Engine : module has no attribute app . ..但属性应用程序在那里(由/_ah/start调用)

转载 作者:行者123 更新时间:2023-11-30 23:28:22 25 4
gpt4 key购买 nike

解析器.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"

解析器.py

import webapp2
class ParseHandler(webapp2.RequestHandler):
def get(self):
self.response.out.write("ok")

app = webapp2.WSGIApplication([
('/init', ParseHandler)
], debug=True)

Google App Engine 对/_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。

最佳答案

应用程序引擎似乎找到了一个内置解析器模块;一个 C 库。

尝试将您的模块从 parser.py 重命名为其他名称。

关于python - Google App Engine : module has no attribute app . ..但属性应用程序在那里(由/_ah/start调用),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21654459/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com