Python2 到 Python 3 转换时出现 Memcache 错误

问题描述 投票:0回答:1

我在 app.yaml 中设置了以下变量。

env_variables:
CURRENT_VERSION_TIMESTAMP: "1677721600"
MEMCACHE_USE_CROSS_COMPATIBLE_PROTOCOL: 'True'
NDB_USE_CROSS_COMPATIBLE_PICKLE_PROTOCOL: 'True'
DEFERRED_USE_CROSS_COMPATIBLE_PICKLE_PROTOCOL: 'True'

在我的 main.py 中我有以下命令

from google.appengine.api import users
from google.appengine.api import wrap_wsgi_app

app.wsgi_app = wrap_wsgi_app(app.wsgi_app)

[1] - Python 3 https://cloud.google.com/appengine/docs/standard/python3/services/access

当我运行时,出现以下错误

File "/layers/google.python.pip/pip/lib/python3.12/site-packages/google/appengine/api/apiproxy_stub_map.py", line 69, in CreateRPC
 assert stub, 'No api proxy found for service "%s"' % service
AssertionError: No api proxy found for service "memcache"
google-app-engine
1个回答
0
投票

如果您还没有找到任何解决方案。

应用程序似乎已经在调用内存缓存,而应用程序尚未初始化,就像正在加载的蓝图中一样。确保应用程序在使用旧版捆绑包之前已初始化。

from google.appengine.api import memcache 
from flask import current_app as app

if app:
    # memcache API calls here
© www.soinside.com 2019 - 2024. All rights reserved.