是否可以从 *Python* Google App Engine 实例执行服务器端 javascript?

发布于 2024-10-01 19:01:32 字数 811 浏览 7 评论 0原文

很多问题已被提出,并且回答了有关在 Google App Engine 上运行服务器端 javascript 的问题,但所有答案都涉及 Java 实例,以便利用基于 Java 的 JS 解释器,例如 Rhino,Rhino for Webapps 等。

有没有办法在 Python GAE 实例上执行服务器端 javascript 代码?我的想法与 pyv8 完全一致,但支持 App Engine (我想这意味着解释器的纯Python实现)。

目前我能想到的唯一解决方案是使用某种粗暴的黑客方式并行运行 Java 和 Python GAE 实例(通过不同版本),这样它们就可以与同一个数据存储区通信,让 Java实例托管 JS 代码,并使用 API 进行交互。不太吸引人。

无需参与所有“这是不必要的,你不应该这样做”的讨论——我知道这并不理想,我只是好奇是否可以做到。

A lot of questions have been asked and answered about running server-side javascript on Google App Engine, but all of the answers deal with Java instances in order to make use of Java-based JS interpreters like Rhino, Rhino for Webapps, etc.

Is there any way to execute server-side javascript code on a Python GAE instance? I'm thinking something exactly along the lines of pyv8, but with support for App Engine (which I guess would mean a pure python implementation of the interpreter).

The only solution I can come up with at the moment is to use some sort of gross hack to run a Java and Python GAE instance side-by-side (via different versions) so they can both talk to the same datastore, let the Java instance host the JS code, and use an API to talk back'n'forth. Not very appealing.

No need to get into all the "this is unnecessary, you shouldn't be doing this" discussion -- I know this isn't ideal and I'm simply curious if it can be done.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

甜妞爱困 2024-10-08 19:01:32

据我所知:

我已经做了一些搜索,但似乎没有人尝试过实现纯 Python Javascript 引擎,我不能责怪他们:这将是对于很少的用例来说,需要做大量的工作(不幸的是,你的就是其中之一)。有几个项目(Grailbrowser 和 Pybrowser)具有用于渲染 HTML 的 Python 代码,因此有一天可能会运行 javascript,但它甚至还没有启动,而且它们都没有在积极开发中。

最有可能发生的方式是 Google 在 Appengine 上提供 Parrot VM(可以运行各种动态语言)。这是一个很酷的主意,但我并没有屏住呼吸。

As far as I can find: No

I've done a bit of searching, but it seems that nobody has tried to implement a pure Python Javascript engine, and I can't blame them: it would be a huge amount of work for very few use cases (unfortunately, yours is one of those). A couple of projects—Grailbrowser and Pybrowser—have Python code to render HTML, so might one day aim to run javascript, but it's not even started, and neither of them look in active development.

The most likely way it would ever happen is if Google were to offer the Parrot VM (which can run various dynamic languages) on Appengine. That's a cool idea, but I'm not holding my breath.

温柔女人霸气范 2024-10-08 19:01:32

可能有效的方法是在 Java 实例中运行 Jython(和 Rhino)。当然,那么你就必须通过 Java API 来访问任何应用程序服务,而不是 Python API,这会很丑陋。

What might work is to run Jython (and Rhino) in a Java instance. Of course, then you'd have to get to any App services through the Java API, not the Python one, which would be ugly.

凉宸 2024-10-08 19:01:32

实际上,确实可以使用 AppEngineJs 或 ESXX 来完成:

http://www.appenginejs.org/

http://esxx.blogspot.com/2009/06 /esxx-on-google-app-engine.html

Actually, it can indeed be done, using either AppEngineJs or ESXX:

http://www.appenginejs.org/

http://esxx.blogspot.com/2009/06/esxx-on-google-app-engine.html

迷爱 2024-10-08 19:01:32

我目前正在尝试使用 PyJON

http://code.google.com/p/pyjon/ 解决同样的问题

似乎是一个纯Python的JavaScrit解析器和解释器。

I am currently trying to solvevthe same problem with PyJON

http://code.google.com/p/pyjon/

Seems to be a pure Python JavaScrit parser an interpreter.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文