简体   繁体   English

Google App Engine实时更新(Python)

[英]Google App Engine Live Updates (Python)

I was wondering if it would be possible to write an application using the Google App Engine and Python to create a basic calculator? 我想知道是否可以使用Google App Engine和Python编写应用程序以创建基本计算器? However, the real question is would it be possible to have the calculator do the math without having to refresh the page? 但是,真正的问题是,有可能让计算器进行数学运算而不必刷新页面吗?

To be more specific, I mean if there is an input box that a formula can be entered into (lets say for example the user inputs 2 + 2) and then the user clicks a submit button or calculate button, can the answer to the inputted problem be solved without the webpage having to refresh itself? 更具体地说,我的意思是,如果存在一个可以在其中输入公式的输入框(例如,用户输入2 + 2),然后用户单击“提交”按钮或“计算”按钮,输入的答案是否可以问题无需网页刷新即可解决? If so, would it be possible to go about this without using AJAX? 如果是这样,是否可以在不使用AJAX的情况下进行此操作? A very brief suggestion on how to go about this or a link to an application and its source code that updates things without refreshing the page would be greatly appreciated! 一个非常简短的建议,关于如何解决这个问题或指向应用程序及其源代码的链接,这些更新无需更新页面即可更新内容!

Thanks in advance for your answers! 预先感谢您的回答!

To make a calculator in a browser that does not involve a page refresh, your best bet is to learn javascript. 要使浏览器中的计算器不涉及页面刷新,最好的选择是学习JavaScript。 Searching google or stackoverflow for javascript tutorials will give you lots of options to work from. 在google或stackoverflow中搜索javascript教程将为您提供很多选择。 You don't need to learn python or App Engine to create the calculator. 您无需学习python或App Engine即可创建计算器。 You could use app engine to serve the javascript, but you wouldn't need to write any python to just serve static content like that. 您可以使用应用程序引擎来提供javascript服务,但无需编写任何python即可提供此类静态内容。

Using GAE you provide a real-time update with "Channels" http://code.google.com/appengine/docs/python/channel/ 使用GAE,您可以使用“频道” http://code.google.com/appengine/docs/python/channel/提供实时更新

The Channel API creates a persistent connection between your application and Google servers, allowing your application to send messages to JavaScript clients in real time without the use of polling. Channel API在您的应用程序和Google服务器之间建立了持久的连接,使您的应用程序可以实时将消息发送到JavaScript客户端,而无需使用轮询。

Interesting enough for your purpose. 对您的目的足够有趣。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM