How to organize ping interactively? My version also works, but you need to wait ...

def pings(request, phost): a = subprocess.Popen('ping -n -c 3 -W 2 %s' %phost,shell=True, stdout=subprocess.PIPE) res = a.stdout.readlines() return render_to_response('switch/pingf.html',{'p':res}) 

    1 answer 1

    Do Django with this is not very. She can, of course, spit out the answer gradually , but there are a lot of pitfalls.

    When I logged support logs to the browser (a sort of tail -f ), I made a separate web server on the side (specifically in my case - on, sorry for the indecent, Node.js, but on Tornado, Twisted or Erlang), which worked with Socket.IO , and Django gave only a page with javascript connecting there. Perhaps this option will be easier. And maybe not.