Version 4 (modified by tanglisha, 18 years ago) ( diff )

--

Django using the Flup FastCGI Module

First you will need the Flup Package. There is an egg, which can get installed very easy using easy_install.

FastCGI

For FastCGI you need a file called yourapplication.fcg. Insert the following code:

#!/usr/bin/env python
import os
import sys
from flup.server.fcgi import WSGIServer
from django.core.handlers.wsgi import WSGIHandler

sys.path.insert(0, '/path/to/your/application')
os.environ['DJANGO_SETTINGS_MODULE'] = 'yourapplication.settings'

WSGIServer(WSGIHandler()).run()

Save somewhere (eg /usr/lib/cgi-bin) and open your Apache conf file (probably called httpd.conf). Make sure that Apache has permission to execute this file.

Insert the following VHost:

<VirtualHost *>
        ServerName www.yourserver.com
        ServerAlias yourserver.com
        # Uncomment the next line when you want to use Suexec
        ##SuexecUserGroup youruser yourgroup

        AddType fastcgi-script .fcg
        ScriptAlias / /path/to/yourapplication.fcg/
</VirtualHost>

Enable and restart Apache.

Note: See TracWiki for help on using the wiki.
Back to Top