【发布时间】:2016-09-17 03:20:50
【问题描述】:
我有一个包含多个独立模块的 App Engine 应用程序。
当deployed 时,这些模块在http://<module>.<app_id>.appspot.com 中可用,当使用dev_appserver.py mod1.yaml mod2.yaml --port-9000 进行本地测试时,mod1 在http://localhost:9000 中运行,mod2 在http://localhost:9001 中运行。所有模块都在同一个项目上运行。到目前为止一切顺利。
假设mod1 需要与mod2 交谈。有没有办法可以动态地在mod1 中获取mod2 的网址?
# In mod1's code
import google.some.magic
url_for_mod2 = magic.get_url_for_module('mod2') # http://localhost:9001 or http://mod2.id.appspot.com
【问题讨论】:
标签: python google-app-engine webapp2 microservices