'Show file contents to html page in django

I am running one shell script from django views.py. Below is the code:

def result(request):
   if request.method=="POST":
       process=subprcoess.Popen(cmd, shell=True, stdout=subprcoess.PIPE, stderr=subprcoess.PIPE, universal_newlies=True)  
       while process.poll() is None:
           print(process.communicate()[0]) 
           continue 
   return render(request, 'result.html')

Now here can able to get logs on file, instead directly need to redirect to html page.

Could anyone please help here?

Thank You.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source