Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of PHP "echo something; exit();" with Python/Django?

Tags:

Sometimes the best way to debug something is to print some stuff to the page, and exit(), how can I do this in a Python/Django site?

e.g. in PHP:

echo $var; exit(); 

Thanks

like image 414
adamJLev Avatar asked Apr 30 '10 20:04

adamJLev


1 Answers

Put this in your view function:

from django.http import HttpResponse return HttpResponse(str(var)) 
like image 81
interjay Avatar answered Oct 21 '22 08:10

interjay