简体   繁体   中英

Run python script in Django and produce live output buffer on the web

I am a beginner to Django web framework. I have a bunch of python scripts which runs and produce output on cli at present but I want the same scripts to run from django web and display live buffer output

Can anyone shed some light on how to achieve it

"Live" output will not be possible without using a more advanced technique or some JS. To get you started, execute the Python code in the view and then pass the results to a template to render them for the user (or as plain HttpResponse).

Have a look at the official docs to get you started if you are a total beginner: https://docs.djangoproject.com/en/4.1/intro/tutorial03/#write-views-that-actually-do-something

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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