简体   繁体   中英

Output python script in django dashboard app

Currently I'm learning to work with the Django framework. I'm trying to make a dashboard that can collect some output of scripts I want to make (in Python). I can't really find a conclusive answer to how to pipe the output of a python script through Django in my app. For instance, I want a script that runs a couple of ARP calls and pings in a network and have the output in a dashboard. Of course python is probably not the only language I'm going to use for scripting, maybe I will use some Bash or Golang also.

I hope someone is able to help my in the right direction.

Thank you in advance!

I have done this for a coding portal that I made.

What I did is, opened a thread that executed code and put the output in a file that was linked to a model filefield

Then I simply collected the contents of the file in the template (dashboard in your case)

If interested,
models.py (Check for Submission and Result model)
Code processing file (This is the file that actually runs the code and collects)

I was in a hurry when I made this. The way I have processed code is highly inefficient and should not be used. But you will get the idea

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