Issue resolved. just needed to decode my output string :
decode('utf-8')
On Friday, November 2, 2018 at 1:20:52 AM UTC+1, sidh wrote:
>
> Hi,
>
> I am executing script using django form and it provides me below results.
> It's good but i would like to render it to html template.
>
> *return HttpResponse(onsubmit, content_type="text/plain")*
>
> Output:
> *URL: https://abc.com <https://abc.com>*
> *Timestamp: Wed, Oct 31, 2018 18:44 GMT*
> *HTTP Response Code: 500*
>
> When i use below for render part my output is not showing with newline.
>
> try:
> onsubmit = subprocess.check_output(["./xyz.py", abc])
> #return HttpResponse(onsubmit, content_type="text/plain")
> context = {
> 'onsubmit': onsubmit,
> }
> return render_to_response('output.html', context=context,
> content_type="text/html")
>
> Output :
> *b'URL: https://abc.com/\nTimestamp <https://abc.com/%5CnTimestamp>: Wed,
> Oct 31, 2018 18:44 GMT\nHTTP Response Code: 500\n*
>
> Any idea how to print this output with newline (like above) ? Any help is
> appreciated.
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/dc1bcb40-66c5-4990-990a-66878345ce91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.