I am using Django SVN rev.4021, Python 2.4.3, Nginx 0.4.12, I cannot
launch Django under FastCGI.

My django.fcgi file is:

#!/usr/bin/env python
import os, sys
sys.path += ['/home/app']
from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_project.settings'
WSGIServer(WSGIHandler()).run()

I am executing FastCGI server with spawn-fcgi (taken from Lighttpd)

spawn-fcgi  -a 127.0.0.1 -p 10001 -u nobody -f
/home/app/django_project/myapp/public/django.fcgi

I am using  Nginx (very fast HTTP server: http://nginx.net/) with
settings;

...
server {
  listen 81;
  server_name localhost;
  error_log /var/log/vservers/test-error.log debug;
  fastcgi_param  GATEWAY_INTERFACE  CGI/1.1;
  fastcgi_param  SERVER_SOFTWARE    nginx;

  fastcgi_param  QUERY_STRING       $query_string;
  fastcgi_param  REQUEST_METHOD     $request_method;
  fastcgi_param  CONTENT_TYPE       $content_type;
  fastcgi_param  CONTENT_LENGTH     $content_length;

  fastcgi_param  SCRIPT_NAME        $fastcgi_script_name;
  fastcgi_param  REQUEST_URI        $request_uri;
  fastcgi_param  DOCUMENT_URI       $document_uri;
  fastcgi_param  DOCUMENT_ROOT      $document_root;
  fastcgi_param  SERVER_PROTOCOL    $server_protocol;

  fastcgi_param  REMOTE_ADDR        $remote_addr;
  fastcgi_param  REMOTE_PORT        $remote_port;
  fastcgi_param  SERVER_ADDR        $server_addr;
  fastcgi_param  SERVER_PORT        $server_port;
  fastcgi_param  SERVER_NAME        $server_name;
  location / {
    root /home/app/django_project/myapp/public;
    rewrite ^/(media|stylesheets|images|javascripts)(.*) /$1/$2 break;
    rewrite ^/(.*)$ /django.fcgi/$1 break;
    fastcgi_pass 127.0.0.1:10001;
    fastcgi_index django.fcgi;
    fastcgi_param SCRIPT_FILENAME
/home/app/django_project/myapp/public$fastcgi_script_name;
  }
}

First, I had to set settings.APPEND_SLASH=False to avoid errors from
flup.  But it did not help. Now I have exception:

  Exception Type:       TypeError
  Exception Value:      unpack non-sequence
  Exception Location:
        /usr/lib/python2.4/site-packages/django/core/handlers/base.py in
get_response, line 65


It is interesting, that under Lighttpd it works. My settings are:

...
   url.rewrite-once = (
     "^/(media|stylesheets|images|javascripts).*" => "$0",
     "^/(.*)$" => "/django.fcgi/$1"
   )

  fastcgi.server = (
    "/django.fcgi" => (
      (
        "bin-path" => "/home/app/django/django_project/django.fcgi",
        "socket" => "/var/run/lighttpd/django.sock",
        "check-local" => "disable",
        "min-procs" => 1,
        "max-procs" => 1,
      )
    ),


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to