| 1 | = Django using the Flup FastCGI Module = |
| 2 | |
| 3 | First you will need the [http://www.saddi.com/software/flup/dist/ Flup Package]. There is an egg, which can get installed very easy using `easy_install`. |
| 4 | |
| 5 | == FastCGI == |
| 6 | For FastCGI you need a file called `yourapplication.fcg`. Insert the following code: |
| 7 | {{{ |
| 8 | #!python |
| 9 | #!/usr/bin/env python |
| 10 | import os |
| 11 | import sys |
| 12 | from flup.server.fcgi import WSGIServer |
| 13 | from django.core.handlers.wsgi import WSGIHandler |
| 14 | |
| 15 | sys.path.insert(0, '/path/to/your/application') |
| 16 | os.environ['DJANGO_SETTINGS_MODULE'] = 'yourapplication.settings' |
| 17 | |
| 18 | WSGIServer(WSGIHandler()).run() |
| 19 | }}} |
| 20 | |
| 21 | Save somewhere (eg `/usr/lib/cgi-bin`) and open your apache.conf. Insert the following VHost: |
| 22 | {{{ |
| 23 | <VirtualHost *> |
| 24 | ServerName www.yourserver.com |
| 25 | ServerAlias yourserver.com |
| 26 | # Uncomment the next line when you want to use Suexec |
| 27 | ##SuexecUserGroup youruser yourgroup |
| 28 | |
| 29 | ScriptAlias / /path/to/yourapplication.fcg/ |
| 30 | </VirtualHost> |
| 31 | }}} |
| 32 | |
| 33 | Enable and restart the Apache. |