【发布时间】:2013-06-25 01:48:43
【问题描述】:
我想知道是否可以/允许在两个应用程序之间共享一个实体,例如一个应用程序创建并存储实体,然后第二个应用程序从第一个应用程序获取密钥,然后可以访问该实体? Second.py 是否需要在其中包含 Ent 类信息,还是仅通过对象就可以了解有关 Ent 的所有信息?
First.py:
class Ent(db.model):
def stuff():
print "I belong to first"
class out(webapp2.RequestHandler):
def get():
e = Ent()
key = e.put()
return key
Second.py:
class in(webapp2.RequestHandler):
response = urllib2.urlopen(urlOfFirstApp)
ent = #access BigTable with response/key, I'm not sure how to do this or if I can or if I'm allowed to
ent.stuff()
【问题讨论】:
-
first.py中有一个错误。e.put后面的括号你忘了;) -
感谢修复。老实说,这应该是有点失控的伪代码。
标签: python google-app-engine google-cloud-datastore urllib2 webapp2