Question

I'm pretty new to web development (not to programming), but I just successfully (sort of) deployed a really basic hello-world style Django app. The first time I did it, I had an issue in my HTML. Here's my whole view with the error:

from django.http import HttpResponse
import datetime

def homepage(request):
  now=datetime.datetime.now()
  html="<html><body><It is now %s.</body></html>" % now
  return HttpResponse(html)

The extra < just after the first body tag caused the browser to display a blank page. I figured out what I did and fixed the error. I also added a title so I'd be able to track what's going on (somewhat) better. The old view became this:

from django.http import HttpResponse
import datetime

def homepage(request):
  now=datetime.datetime.now()
  html="<html><head><title>Hello</title></head><body>It is now %s.</body></html>" % now
  return HttpResponse(html)

Now the browser displays the old view (a blank page) most of the time, just the title with a blank body sometimes, and occasionally the whole correct new view. I have no clue what's going on. I'm running nginx with flup to handle the FastCGI. Ideas?

Was it helpful?

Solution

After changing your code you need to restart your FastCGI server, not Nginx.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top