gpt4 book ai didi

python - 您可以在 google appengine 之外使用 GQL/Google DataStore 吗?

转载 作者:太空宇宙 更新时间:2023-11-03 18:13:01 24 4
gpt4 key购买 nike

我可以在本地 python 应用程序中使用 GQl/DataStore 吗?我知道在编写 Web 应用程序时运行 dev_appserver.py 时可以在本地使用它们,但现在我不想做任何与 Web 相关的事情,而是只使用普通的 pythonfile.py 来将其保留在本地,没有 HTML 接口(interface)。是否有可能做到这一点?

最佳答案

The Remote API can also be used within local applications. This will allow you to write local applications that use App Engine services and access datastore. It is important to note that using the Remote API will incur quota usage on the application you are accessing.

Before beginning, make sure the App Engine SDK is added to your Python path and Remote API is enabled in your App Engine application. The following example shows the use of OAuth 2.0 credentials to configure the Remote API:

from google.appengine.ext.remote_api import remote_api_stub
from helloworld import helloworld

remote_api_stub.ConfigureRemoteApiForOAuth('your_app_id.appspot.com',
'/_ah/remote_api')

# Fetch the most recent 10 guestbook entries
entries = helloworld.Greeting.all().order("-date").fetch(10)
# Create our own guestbook entry
helloworld.Greeting(content="A greeting").put()

引用:https://cloud.google.com/appengine/docs/python/tools/remoteapi

关于python - 您可以在 google appengine 之外使用 GQL/Google DataStore 吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25536850/

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