I have posted this to devshed as well, but I guess no-one has any suggestions there. Hopefully you will be able to point me to further understanding of this area.
I have 2 questions and I would be most grateful for some help please.
I am having great problems with understanding how nginx loads up a django application using fastcgi.
I have a development server running nginx and fastcgi on a Debian squeeze system.
In my django project directory, there is an index.fcgi which I want to be loaded when I go to the local domain http://mydomain.lcl
I guess that the index.fcgi is a python program which gets loaded and interpreted by the fastcgi server which gets called by the nginx location block to handle the index.fcgi.
I assume there is some mechanism to get from the index.fcgi to the django application directory and on from there to running the application.
My first question is...
Where can I read up about this process please?
My second question is...
What can I place in the index.fcgi to basically display "Hello World" or "this is index.fcgi" so that I know everything is being routed correctly through nginx, fastcgi, and reaching the django project directory?
something like this, but this does not do it.
- Code: Select all
from django.http import HttpResponse
HttpResponse("Hello, world. You're at the djangoblog index.fcgi")
I have also found this which works to a certain extent. and may
help others in their understanding of the process somehow.
When I point my fastcgi server to this python program, it displays
the plain text in the browser, but does not show any html when I
change the Content-Type: (see below)
- Code: Select all
# enable debugging
# this gives a 502 Bad Gateway error in nginx
print "Content-Type: text/html;charset=utf-8"
print "<html><head><title>my title</title><head>"
print "<body><p>This is the body of the page</p></body></html>"
# This works fine by displaying plain text in the browser
#print "Content-Type: text/plain;charset=utf-8"
#print "Hello World! Hello Paul !!"