What is FastCGI?
FastCGI is a Faster CGI. CGI is the Common Gateway Interface used for connecting programs into a web server. FastCGI is a method which enables a web server to communicate with long-running scripts. This has the advantage that the script is only started and initialized one time, and that data could be cached in memory from request to request, enhancing the performance of the CGI application. This wiki is running using FastCGI.
http://blogs.sun.com/oswald/entry/good_idea_python_with_fastcgi
I was using mod_wsgi, which is the new standard for Python web apps, but BlueHost doesn't support it yet, so FastCGI will do.
Example Settings for MoinMoin
www/.htaccess
# Run Python with FastCGI AddHandler fcgid-script .fcg
www/cgi-bin/moin.fcg
1 #!/usr/bin/env python
2 # -*- coding: iso-8859-1 -*-
3 """
4 MoinMoin - FastCGI Driver Script
5
6 @copyright: 2008 MoinMoin:ThomasWaldmann
7 @license: GNU GPL, see COPYING for details.
8 """
9
10 import sys, os
11
12 # a) Configuration of Python's code search path
13 # If you already have set up the PYTHONPATH environment variable for the
14 # stuff you see below, you don't need to do a1) and a2).
15
16 # a1) Path of the directory where the MoinMoin code package is located.
17 # Needed if you installed with --prefix=PREFIX or you didn't use setup.py.
18 #sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')
19 sys.path.insert(0, '/home/david/moinmoin/')
20
21 # a2) Path of the directory where wikiconfig.py / farmconfig.py is located.
22 # See wiki/config/... for some sample config files.
23 #sys.path.insert(0, '/path/to/wikiconfigdir')
24 #sys.path.insert(0, '/path/to/farmconfigdir')
25
26 # b) Configuration of moin's logging
27 # If you have set up MOINLOGGINGCONF environment variable, you don't need this!
28 # You also don't need this if you are happy with the builtin defaults.
29 # See wiki/config/logging/... for some sample config files.
30 #from MoinMoin import log
31 #log.load_config('/path/to/logging_configuration_file')
32
33 # Debug mode - show detailed error reports
34 #os.environ['MOIN_DEBUG'] = '1'
35
36
37 from MoinMoin.server.server_fastcgi import FastCgiConfig, run
38
39 class Config(FastCgiConfig):
40 #properties = {}
41 properties = {'script_name': '/wiki'}
42 # properties = {'script_name': '/'} # use this instead of the line above if your wiki runs under "/" url
43
44 # for backlog, we use a default of 5. if the listen(backlog) call crashes for you, try a smaller value!
45 # backlog = 1
46
47 run(Config)
Update: Actually MoinMoin 1.92 is now using flup in the moin.fcg FastCGI handler to create a WSGI server which then calls the application. So I am using both FastCGI and WSGI to serve this wiki.
mod_fcgid
To kill my mako.fcgi script I use kill $(pidof -x mako.fcgi) (The -x means find the pid of a script).
