在本地运行 Python Web 应用程序的最佳方式
我正在考虑应用程序用户界面的几种选项。
我希望这个应用程序是多平台的(Windows、Linux、OSX),因此我考虑的选项之一是将其开发为 Web 应用程序,但在本地服务器上运行它仍然可以访问管理员权限(即必需的)。简单地说,就是我的程序的网络界面。
出于方便的原因,我想用 python 进行开发。
是否建议使用 Pylons 来完成这项工作?如果是,那么在此设置中运行它的最佳方法是什么?
I'm considering several options for the user interface of an application.
I want this application to be multi-platform (Windows, Linux, OSX), so one of the options I considered was to develop it as a web application, but run it on a local server to still have access to administrator privileges (which are required). simply, a web interface to my program.
I want to develop in python for convenience reasons.
Does using Pylons for this job is recommended and if so, what is the best way to run it in this setup?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以考虑web2py。该框架本身非常容易设置、学习和使用,并且它提供了一种简单的方法将您的应用程序作为二进制文件分发。用户只需解压缩它并单击运行,它将作为独立应用程序在用户计算机上的浏览器中运行。它甚至包括自己的 Python 解释器,因此用户不必安装 Python(这在 Windows 上非常有用,因为 Windows 通常不安装 Python)。内置的 Rocket 服务器 足以在本地运行(有些人甚至在生产)。您还可以将 Rocket 与其他框架一起使用。如果您需要帮助,请在邮件列表中提问。
You might consider web2py. The framework itself is very easy to set up, learn, and use, and it provides an easy way to distribute your app as a binary. The user would simply unzip it and click run, and it will run as a standalone app in the browser on the user's machine. It even includes its own Python interpreter, so the user doesn't have to have Python installed (very helpful on Windows, which does not typically have Python installed). The built-in Rocket server will be more than adequate for running locally (some people even use it in production). You can also use Rocket with other frameworks. If you need help, ask on the mailing list.
看看微型 Web 开发框架 Flask。
从 docs 中:
将其保存为 hello.py 或类似的内容,然后使用 Python 解释器运行它。
Have a look at the micro webdevelopment framework Flask.
From the docs:
Save it as hello.py or something similar and run it with your Python interpreter.
看来 PySimpleGUI 就是您所寻找的。
您不需要编写任何 HTML,实际上使用与您相同的 Python 编程界面
可以创建窗口应用程序或Web应用程序。
还包含 Web 服务器,无需额外依赖
It seems that PySimpleGUI is what you look for.
You don't need to write any HTML and in fact with the same Python programming interface you
can create a window application or a web application.
Web server is also included, no need of extra dependencies