创建用于Python数值仿真代码的Web界面(以及在哪里托管它)
我需要为Python数值模拟代码创建Web界面,并托管(接口和Python代码)。 当用户运行模拟时,模拟完成可能需要数小时甚至几天(当然,对于多个用户,它必须并行运行许多模拟)。
因此,我想知道我的选择是什么。
使用接口的前端框架和python代码的Web服务器? 或使用诸如Django(我从未使用过的)框架
,我还可以在哪里托管这样的代码(Python代码),是否有AWS或GCP这样的提供商可以选择它?
I need to create a web interface for a Python numerical simulation code, and host both (interface and python code).
When a user will run a simulation, it could take hours, or even days for the simulation to finish (and of course it has to run many simulations in parallel for multiple users).
So I am wondering what are my options to achieve this.
Use a frontend framework for the interface and a web server for the python code ?
Or use a framework like Django (which I never used)
And also where can I host such a code (the Python code), is there any provider like AWS or GCP which have a good option for it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将任何堆栈用于前端,并使用python的任何后端(例如烧瓶或fastapi)使用任何框架,django也是一个不错的选择(即使没有经验,您也可以快速创建一个项目)!
但是我猜您选择的哪种选项,“代码仿真”的一部分需要大量时间分开起作用。例如,您可以使用
托管呢,我不是专家,但我认为这取决于预算,也许是国家。对于托管后端和前端,我认为Heroku是一个不错的选择,但我不确定它适合托管相关的零件。您可以考虑诸如Google Cloud,Digital Ocean之类的选项,也许您可以找到便宜的VPS提供商。
You can use any stack for frontend with any framework for backend in Python (e.g. Flask or FastAPI), Django is a great option too (even without experience, you can quickly create a project)!
But I guess whatever option you choose, the part of "code simulation" that takes a lot of time should work separately. For example, you can use something like Celery to queue the tasks. All in all, the part of simulating should be independent from backend and maybe even written in another language, it should only take tasks and return results. You can even host it on another more powerful machine.
What about hosting, I'm not an expert, but I think it depends on the budget, and maybe country. For hosting backend and frontend I think Heroku is a good option, but I'm not sure is it suitable for hosting simulation related part. You can consider options like Google Cloud, Digital Ocean or maybe you can find cheaper VPS providers.