如何创建使用数据存储区的Python端点?

时间:2016-05-23 02:54:25

标签: python google-app-engine google-cloud-endpoints google-cloud-datastore protorpc

我正在尝试为Android创建一个Python端点,并最终使用ios应用程序将数据存储在数据存储区中,但我无法理解它们是如何组合在一起的。

我知道我希望有3个实体UserEventMessage。在我的应用程序中,我希望能够查询,插入和更新User。事件将作为User实体的“更新”处理。然后,我还希望能够查询并插入所述User的消息,这就是我不使用GCM的原因。

我的User实体目前看起来像这样:

class User(ndb.Model):
    email = ndb.StringProperty()
    first_name = ndb.StringProperty(indexed=False)
    last_name = ndb.StringProperty(indexed=False)
    prof_pic = ndb.BlobProperty(indexed=False)
    status = ndb.StringProperty(indexed=False)
    location = ndb.StringProperty(indexed=False)
    friends = ndb.StringProperty(repeated=True, indexed=False)
    repeating_events = ndb.KeyProperty(repeated=True, indexed=False)
    non_repeating_events = ndb.KeyProperty(repeated=True, indexed=False)

我的Event实体如下所示:

class Event(ndb.Model):
    start_time = ndb.StringProperty()
    end_time = ndb.StringProperty()
    color = ndb.StringProperty()
    isRepeating = ndb.BooleanProperty()

我的Message实体看起来像这样:

class Message(ndb.Model):
    message_to = ndb.KeyProperty()
    message_from = ndb.KeyProperty()
    text = ndb.KeyProperty()

我认为我对datastore有一个很好的理解,并且对endpoint应该如何工作的一般理解。我之前用Java编写了这一切,但是由于启动时间慢和Java中AppEngine的一般错误,我决定使用Python。这就是说我很难解决这个问题与我的Android应用程序的关系,因为我对Python不太自信。

在提供的示例tick tick toe应用程序中,他们使用了ProtoRPC消息库,我认为endpointdatastore之间的通信,但我真的不明白它是如何工作的因为User包含User的列表,所以实际上无法让我的改编无误。

我的问题是应该使用ProtoRPC库的原因,原因,地点和方式。

0 个答案:

没有答案
相关问题