[英]How to add Python module in existing Java Application
I have a GAE Java app already deployed which is using Datastore. 我已经部署了使用数据存储区的GAE Java应用程序。 Now, I need to split that app in modules and have second module which is written in Python to access that same Datastore. 现在,我需要将该应用程序拆分为模块,并具有用Python编写的第二个模块,以访问同一数据存储区。 I cannot find useful info on how to split app in modules in a way that: 我找不到有关如何以以下方式在模块中拆分应用程序的有用信息:
Main question would be: what are steps to do define these two modules with different programming languages. 主要问题将是:使用不同的编程语言来定义这两个模块的步骤是什么?
Thanks in advance. 提前致谢。
You can use app.yaml
to configure your main (Java) module, as detailed at https://cloud.google.com/appengine/docs/java/configyaml/appconfig_yaml , and separate .yaml
files to configure your other (Python, PHP, and/or Go -- or also, some of them could also be Java!-)) modules, as detailed at https://cloud.google.com/appengine/docs/python/modules/#Python_Configuration . 您可以使用app.yaml
来配置您的主要(Java)模块,如https://cloud.google.com/appengine/docs/java/configyaml/appconfig_yaml中所述 ,并可以使用单独的.yaml
文件来配置其他模块(Python, PHP和/或Go-或,其中一些也可能是Java!-))模块,如https://cloud.google.com/appengine/docs/python/modules/#Python_Configuration所述 。
As you suspect, all modules always do access exactly the same instance of the datastore. 您可能会怀疑,所有模块始终确实访问数据存储区的完全相同的实例。
So for example you could have in app.yaml
...: 因此,例如,您可以在app.yaml
...:
application: myapp
version: alpha-001
runtime: java
api_version: 1
handlers:
- url: /myjava/*
servlet: myapp.myservlets.DoItAllServlet
to map all urls /myjava/something
to that single servlet, and in eg mypython.yaml
将所有URL /myjava/something
映射到单个servlet,例如在mypython.yaml
application: myapp
module: mypython
version: v1
runtime: python27
handlers:
- url: /mypy/*
script: mypython.app
to map all URLs /mypy/something
to the single WSGI application bound to global variable app
in module mypython.py
. 将所有URL /mypy/something
映射到模块mypython.py
绑定到全局变量app
的单个WSGI应用程序。 Of course, there are huge numbers of degrees of freedom on both the main ("default") module, and the other ones, I'm just trying to show the very simplest "skeleton" here!-) 当然,在主模块(“默认”)和其他模块上都有大量的自由度,我只是在这里展示最简单的“骨架”!-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.