简体   繁体   English

如何在不使用像flask和django这样的框架的情况下在html网站上运行小型python脚本?

[英]How do I run small python scripts in a html website without using frameworks like flask, and django?

I have 10 line python code and a third party python library that I want to use in a html website. 我有10行python代码和第三方python库,我想在html网站中使用。 I do not want to use a full fledged framework like django to complete the task. 我不想使用像django这样的完整框架来完成任务。 I want to use the following library https://github.com/nficano/pytube in my project. 我想在我的项目中使用以下库https://github.com/nficano/pytube Thank You looking forward for some assistance. 谢谢你期待一些帮助。

The most simple thing come to my mind is following. 我想到的最简单的事情就是跟随。

1) You'll need to use some sort of WSGI ( https://uwsgi-docs.readthedocs.io/en/latest/ , for example), to serve your script as a web service. 1)您需要使用某种WSGI(例如https://uwsgi-docs.readthedocs.io/en/latest/ )来将您的脚本作为Web服务提供。

2) You'll also need a little bit of JavaScript code to make AJAX (for example) requests to that script. 2)您还需要一些JavaScript代码来向该脚本发出AJAX(例如)请求。

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

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