假设我有一条消息定义为test.proto:
message TestMessage {\n int64 id = 1;\n string title = 2;\n string subtitle = 3;\n string description = 4;\n}\nRun Code Online (Sandbox Code Playgroud)\n我使用 protoc 将其转换为 Python,如下所示:
\nprotoc --python_out=. test.proto
时间PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python:
from test_pb2 import TestMessage\n\n%%timeit\ntm = TestMessage()\ntm.id = 1\ntm.title = 'test title'\ntm.subtitle = 'test subtitle'\ntm.description = 'this is a test description'\nRun Code Online (Sandbox Code Playgroud)\n6.75 \xc2\xb5s \xc2\xb1 152 ns per loop (mean \xc2\xb1 std. dev. of 7 runs, 100000 loops each)
时间PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp:
我有一个应用程序需要多个域指向同一个应用程序并显示不同的数据,但我在所有域中也有相同的“管理”子域,它也根据域显示不同的数据。
一个例子是:
pinetree.com - displays information about pine trees
oaktree.com - displays information about oak trees
admin.pinetree.com - displays admin for managing pine trees
admin.oaktree.com - displays admin for managing oak trees
Run Code Online (Sandbox Code Playgroud)
到目前为止,我发现您需要SERVER_NAME在 Flask 配置中写入(域名)才能在 Flask 中使用子域,但是由于我有许多不同类型的具有唯一域的树,并且一直在添加新树,我不知道如何使用该功能。
此外,我已经看到 GAE flexible 没有多租户,这是我最初想到的在 GAE 上管理多个域的方法。