Showing posts with label Django. Show all posts
Showing posts with label Django. Show all posts

2008/08/04

Hosting Muliple Site Django under Nginx with WSGI

My site is very small and the hosting provider have strict limit on memory. I compile the Nginx like this:

./configure --prefix=$HOME/nginx_build --with-cpu-opt=pentium4 --add-module=./mod_wsgi --without-http_autoindex_module --without-http_auth_basic_module --without-http_charset_module --without-http_ssi_module --without-http_geo_module --without-http_map_module --without-http_proxy_module --without-http_memcached_module --without-http_rewrite_module --without-http_referer_module --without-http_upstream_ip_hash_module --without-http_browser_module --without-http_limit_zone_module --without-http_empty_gif_module --conf-path=$HOME/conf/nginx.conf

The most important thing that host Django by mod_WSGI is
add
wsgi_use_main_interpreter off;
wsgi_enable_subinterpreters on;
to your conf file. Mod_wsgi need to create distinct sub interpreters.

2008/07/12

Let Django work with view cache

  1. Modify django/utils/decorators.py

    --- django/utils/decorators.py (revision 4490)

    +++ django/utils/decorators.py (working copy)

    @@ -30,4 +30,12 @@

    return result

    return response

    return _wrapped_view

    +

    + def _true_24_decorator(*args, **kwargs):

    + def _decorator(f):

    + return _decorator_from_middleware(f, *args, **kwargs)

    + return _decorator

    +

    + _decorator_from_middleware.decorator = _true_24_decorator

    +

    return _decorator_from_middleware

  2. Usage:

    @cache_page.decorator(60)

    def my_cool_view(request):

    # cool processing

2008/07/08

New Group Webpage is on line written by Django

http://biocroma.uzh.ch

It is a django site. Django is very good and fast developing.