【发布时间】:2014-04-23 10:19:35
【问题描述】:
作为第一次使用 Python 的程序员(具有 Java 和 PHP 经验),我开始研究 Cloud Endpoint API。
我希望将所有内容集中在一个 API 中,但将不同的资源调用拆分到不同的文件中。文档以此为例:
an_api = endpoints.api(name='library', version='v1.0')
@an_api.api_class(resource_name='shelves')
class Shelves(remote.Service):
...
@an_api.api_class(resource_name='books', path='books')
class Books(remote.Service):
...
endpoints.api_server([an_api])
我想做的是将Shelves 和Book 类放在不同的文件中,因为它们都会变得很长。我尝试只移动它们,但这会导致 API 发现文档为空,因为这些文件可能在 API 启动时没有加载/运行/解释。
我该如何解决这个问题?我有一种感觉,import 会有点问题,但我想不通...
谢谢!
【问题讨论】:
标签: python google-app-engine google-cloud-endpoints