Q:

Why does Django serve my page as a download?

I have a Web app written in Python+Django. On my machine, it works fine; as soon as I push it into production, it starts acting up.
For some reason, my login screen loads fine. But, as soon as I try to log in, I get the homepage either as a download (if I turn gzip middleware on), or as a plain text page containing the response.
My production server runs Python 2.6.8, and my Django version is 1.4.1-final. I don't have access to mod_wsgi, so I use CGI instead. Here's my .htaccess and FCGI script. It's really just a cheap shared hosting plan, but I have another Django site there that works fine.

A:

It seems unlikely, but setting a different content_type in your response can make this happen sometimes, e.g. 

response = HttpResponse(my_data, content_type='application/vnd.ms-excel')
      response['Content-Disposition'] = 'attachment; filename="foo.xls"'

(Django Docs)
Can you link a line or two of your response call?

