数据存储库口香糖
gumo-datastore的Python项目详细描述
Gumo数据存储
配置
fromgumo.coreimportconfigureascore_configurefromgumo.datastoreimportconfigureasdatastore_configurecore_configure(google_cloud_project='<Google Cloud Platform Project Name>',google_cloud_location='<Project Main Location (Region)>',)datastore_configure(use_local_emulator=True,emulator_host='datastore_emulator:8081',namespace=None,)
如果需要加载app.yaml的环境变量:
importosimportflaskfromgumo.coreimportMockAppEngineEnvironment# from gumo.core import configure as core_configure# from gumo.datastore import configure as datastore_configure# The call to MockAppEngineEnvironment must precede any other initialization code.if__name__=='__main__':app_yaml_path=os.path.join(os.path.dirname(os.path.abspath(__file__)),'app.yaml')MockAppEngineEnvironment.load_app_yaml(app_yaml_path=app_yaml_path)# core_configure(...)# datastore_configure(...)# Application Configurations ...app=flask.Flask(__name__)# TODO: Add a sample of Repository implementation using DatastoreRepositoryMixin.if__name__=='__main__':app.run(host='0.0.0.0',port=8080,debug=True)
设置开发环境
$ git clone https://github.com/gumo-py/gumo-core.git
$ cd gumo-core
$ make setup
构建和测试
$ make build
$ make test