Source

iZoo / INSTALL

[ Must have ]

    - Python 2.*
    - Python mysqldb
    - Python imaging library (PIL)
    - Python Libxslt
    - Python cssutils
    - Django 1.2.4
    - MySQL 5.1

    - fb2docbook
    - docbook-xsl

[ Converter ]
    [ fb2docbook ]

    http://kir666.ru/fb2docbook/   {rus}
    Download last one
        ( http://kir666.ru/fb2docbook/download/fb2docbook.src-0.1.bzr349.zip
        on 19.01.2011 )

        copy files to folder 'converter'

    [ docbook-xsl ]
        http://sourceforge.net/projects/docbook/
        Download and extract files to
            '/usr/share/sgml/docbook/xsl-stylesheets'
            (on Ubuntu)

    Try to conver any book
        'python btransformer.py --config btconfig_default.xml --epub file.fb2 file.epub'
    Resolve dependency


[ Configuring ]

    Copy local_settings.py.sample to local_settings.py
    And edit it and run
     - python manage.py syncdb
     - python manage.py createcachetable django_cache
     - go to http://ip/UpdateData
        Book table could on fastcgi get fimeout
        and do not send response
        but the script will finish work normal


[ Run ]

    it could be run with embedded developer web server
     - python manage.py runserver <ip>:<port>

    Or through cgi server and for example Nginx
    Simple init script for fcgi 
     - python manage.py runfcgi <keys>

[ Init script example ]

    #!/bin/bash

    # It is a simple example
    # modify it for using!

    echo "FastCGI Django."
    USER=www-data
    ROOT=/var/www/iZoo

    start() {
        echo -n "Starting Django FastCGI: "
        su $USER -c " python $ROOT/manage.py runfcgi \
                socket=$ROOT/fcgi.sock \
                pidfile=$ROOT/fcgi.pid \
                maxspare=2 \
                maxchildren=5"

        RETVAL=$?
        echo "FastCGI Django."
    }

    stop() {
        echo -n "Stopping Django FastCGI: "
        kill `cat $ROOT/fcgi.pid`
        RETVAL=$?
        echo "FastCGI Django."
    }

    case "$1" in
        start)
            start
        ;;
        stop)
            stop
        ;;
        restart)
            stop
            start
        ;;
        *)
            echo "Usage: django-fastcgi {start|stop|restart}"
        exit 1
        ;;
    esac

    exit $RETVAL


[ Nginx config example ]

    server {
        listen   80;
        server_name  izoo.ru www.izoo.ru;

        keepalive_timeout  120;

        #access_log  /var/log/nginx/izoo.access.log;
        error_log /var/log/nginx/izoo.error.log;

        location / {
            include /etc/nginx/fastcgi_params;
            fastcgi_pass    unix:/var/www/izoo/fcgi.sock;
            fastcgi_param   PATH_INFO $fastcgi_script_name;
            fastcgi_pass_header     Authorization;
            fastcgi_intercept_errors off;
        }
        location /media {
            alias   /var/www/izoo/media;
        }
        location /static {
            alias   /var/www/izoo/static;
        }

    }