I just picked up Django a couple days ago and I don't have much experience with any languages other than java, so Python is a bit of a learning curve. I manages to create a web page that generates a random number each time you refresh it and tells you whether or not it is the number one.
The problem lies in using multiple lines on a single page. Instead of having the page look like that, I want it to be formatted vertically, like this:

n = random.randint(1, 2) # returns a random integer
if n == 1:
query = "The number is One."
else:
query = "The number Is'nt One."
return HttpResponse(str('Randomly generated number: ') + str(n) + str(" ") + str(query))
One thing I noticed is that all the code after "return HttpResponse" is unused, for example if I had moved the "if" and "else" statements to after the HttpResponse, it would be marked as unused code and would not appear on the final product.
<br>is newline in html ... its probably time for you to start exploring templates...<br>would work also. And sidenote: You don't need tostr()something that is already a string value likestr(" ")