メモ

もっと丁寧にまとめます:-(

==========================
Django and Cherokee server
==========================

Django with Cherokee and SCGI
=============================

Ubuntu Server 7.04

::

  aptitude install sqlite3 python2.5-dev python2.5

flup のインストール
-------------------

::
  
  wget http://www.saddi.com/software/flup/dist/flup-0.5.tar.gz
  sudo python setup.py install


Cherokee のインストール
-----------------------

::

  aptitude install cherokee

::

  aptitude install bison flex gcc g++ libssl libssl-dev

  wget http://www.cherokee-project.com/download/0.5/0.5.6/cherokee-0.5.6.tar.gz

  ./configure --prefix=/usr/local/cherokee-0.5.6 \
  -enable-tls=openssl \
  --disable-pam --disable-ipv6 --disable-largefile

Cherokee の設定
---------------

::

  vim /etc/cherokee/sites-avaiable/django

  UserDir public_html {
    Directory / {
      Handler scgi {
        Server localhost:8080
      }
    }
  }

  Directory /site_media/ {
    DocumentRoot /var/www/
    Handler common
  }

  Directory /media/ {
    DocumentRoot /var/www/
    Handler common
  }

Cherokee の起動
---------------

::

  /etc/init.d/cherokee start


改悪
----

django/core/handlers/wsgi.py::

  class WSGIRequest(http.HttpRequest):
      def __init__(self, environ):
          self.environ = environ
          print environ
          try:
              self.path = environ['REQUEST_URI']
          except:
              self.path = environ['PATH_INFO'] 

実行
----

::

  python manage.py runfcgi protocol=scgi method=threaded host=localhost port=8080 daemonize=false

確認
----

::

  http://localhost/admin/