你可以使用github.com/golang/appengine来访问Datastore。

huangapple go评论109阅读模式
英文:

How do I access Datastore using github.com/golang/appengine?

问题

我正在使用github.com/golang/appengine及其相关的"datastore"。我希望这个包能让我在一个普通的Go网站中使用Datastore。不幸的是,我的代码

c := appengine.NewContext(rq)

一直报错"NewContext passed an unknown http.Request"。我的app.yaml文件包含以下内容:

application: sdklessdatastoremusic
version: 1
runtime: go
api_version: go1

handlers:
- url: /.*
  script: _go_app

vm: true
manual_scaling:
  instances: 1

这个YAML文件应该怎么写?还是问题出在其他地方?

英文:

I am using github.com/golang/appengine and its associated "datastore". I was hoping this package would allow me to use Datastore in a normal Go website. Unfortunately, my

c := appengine.NewContext(rq) 

keeps giving my a "NewContext passed an unknown http.Request" error. My app.yaml contains

application: sdklessdatastoremusic
version: 1
runtime: go
api_version: go1

handlers:
- url: /.*
  script: _go_app

vm: true
manual_scaling:
  instances: 1

What should that YAML be, or is the problem elsewhere?

答案1

得分: 1

App Engine的软件包仅适用于在App Engine本身上运行时,而不适用于其他地方。

英文:

The App Engine packages only apply for when you are running on App Engine itself, not elsewhere.

huangapple
  • 本文由 发表于 2014年5月10日 11:02:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/23576654.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定