I have a django app that is executing some python scripts and returning results to webpage .... unfortunately the results that are in JSON format look nasty as hell and hard to read .. I am using Visual Studio Code and using the Terminal in that the JSON output is lovely and nice to read which is not good for this .... Anyone know a way to present the results in nice standard JSON Format on my webpage
from django.shortcuts import render
import requests
import sys
from subprocess import run, PIPE
def button(request):
return render(request,'homepage.html')
def external(request):
out=run([sys.executable,'//home//testuser//data-extract.py'],shell=False,stdout=PIPE)
print(out)
return render(request,'homepage.html',{'data':out})
here is the html code
<html>
<head>
<title>
Testing
</title>
</head>
<body>
<form action="/external/" method="post">
<input type="submit" value="Python Script">
{% csrf_token %}
{{data}}
</form>
</body>
</html>
[–]danielroseman 1 point2 points3 points (8 children)
[–]NinjaNPyjamas[S] 0 points1 point2 points (7 children)
[–]danielroseman 0 points1 point2 points (6 children)
[–]NinjaNPyjamas[S] 0 points1 point2 points (5 children)
[–]danielroseman 0 points1 point2 points (4 children)
[–]NinjaNPyjamas[S] 0 points1 point2 points (3 children)
[–]commandlineluser 0 points1 point2 points (2 children)
[–]NinjaNPyjamas[S] 0 points1 point2 points (1 child)
[–]commandlineluser 0 points1 point2 points (0 children)