在 Web 服务器上嵌入 python 程序并通过移动应用程序连接到它

embedding python program on a web server and connecting to it through Mobile App

我目前正在开发适用于 android 设备的应用程序。但是,该应用程序太大而无法为该设备构建。因此,我想构建应用程序的核心(完成大部分工作的部分)并将其放置在服务器上,并为移动设备构建应用程序的轻量级部分。 android设备上的App是连接服务器上的应用,收集处理后的信息。我想在使用 Python 语言的服务器上构建 运行 的应用程序,因为我正在处理的应用程序执行大量数字 c运行ching。这可能吗?如果是这样,我如何将我的 Python 脚本嵌入到网络服务器以及如何将它 link 嵌入我的应用程序

在服务器端,我建议查看 Flask framework (you may find the Flask-Restful framework and having the mobile app accessing it via a REST API. This may be useful depending on your Android experience: http://developer.android.com/training/volley/simple.html However, if you are doing a lot of number crunching, you may need to use WebSockets to connect the two and run your processing in a background thread. In which case I would look at http://www.elabs.se/blog/66-using-websockets-in-native-ios-and-android-apps and https://flask-socketio.readthedocs.org/