view wiki/server/moin.fcgi @ 5491:65bf6cb180b7

moin.fcgi: fix recursion error and some minor cosmetics
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Thu, 04 Feb 2010 10:01:53 +0100
parents a68d363312db
children e900c097a46b
line wrap: on
line source
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
    MoinMoin - CGI/FCGI Driver script

    @copyright: 2000-2005 by Juergen Hermann <jh@web.de>,
                2008 by MoinMoin:ThomasWaldmann,
                2008 by MoinMoin:FlorianKrupicka,
                2010 by MoinMoin:RadomirDopieralski
    @license: GNU GPL, see COPYING for details.
"""

import sys, os

# a) Configuration of Python's code search path
#    If you already have set up the PYTHONPATH environment variable for the
#    stuff you see below, you don't need to do a1) and a2).

# a1) Path of the directory where the MoinMoin code package is located.
#     Needed if you installed with --prefix=PREFIX or you didn't use setup.py.
#sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages')

# a2) Path of the directory where wikiconfig.py / farmconfig.py is located.
#     See wiki/config/... for some sample config files.
#sys.path.insert(0, '/path/to/wikiconfigdir')
#sys.path.insert(0, '/path/to/farmconfigdir')

# b) Configuration of moin's logging
#    If you have set up MOINLOGGINGCONF environment variable, you don't need this!
#    You also don't need this if you are happy with the builtin defaults.
#    See wiki/config/logging/... for some sample config files.
from MoinMoin import log
#log.load_config('/path/to/logging_configuration_file')
logging = log.getLogger(__name__)

## this works around a bug in flup's CGI autodetection (as of flup 1.0.1):
#os.environ['FCGI_FORCE_CGI'] = 'Y' # 'Y' for (slow) CGI, 'N' for FCGI

# Creating the WSGI application
# use shared=True to have moin serve the builtin static docs
# use shared=False to not have moin serve static docs
# use shared='/my/path/to/htdocs' to serve static docs from that path
from MoinMoin.web.serving import make_application
application = make_application(shared=True)

## Uncomment this if you need to set the SCRIPT_NAME:
#def script_fixer(env, start):
#    env['SCRIPT_NAME'] = ''  # use '' for running at /, '/wiki' for running at /wiki/
#    return application(env, start)
#application = script_fixer

## Choose your server mode (threaded, forking or single-thread)
try:
    from flup.server.fcgi import WSGIServer
#    from flup.server.fcgi_fork import WSGIServer
#    from flup.server.fcgi_single import WSGIServer
except ImportError:
    logging.warning("No flup-package installed, only basic CGI support is available.")
    from MoinMoin.web._fallback_cgi import WSGIServer

WSGIServer(application).run()