Mercurial > moin > 1.9
changeset 2986:d6fb846dc73c
use MoinMoin.server for fastcgi, use Config class, fix logging (port from 1.6)
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sun, 06 Jan 2008 16:04:20 +0100 |
parents | af66750c66e4 |
children | c817a9c0d0e5 |
files | wiki/server/moin.fcg |
diffstat | 1 files changed, 15 insertions(+), 44 deletions(-) [+] |
line wrap: on
line diff
--- a/wiki/server/moin.fcg Sun Jan 06 16:02:03 2008 +0100 +++ b/wiki/server/moin.fcg Sun Jan 06 16:04:20 2008 +0100 @@ -3,64 +3,35 @@ """ MoinMoin - FastCGI Driver Script - TODO: this should be refactored so it uses MoinMoin.server package - (see how Twisted, WSGI and Standalone use it) - - @copyright: 2004-2005 by Oliver Graf <ograf@bitart.de> + @copyright: 2007 MoinMoin:ThomasWaldmann @license: GNU GPL, see COPYING for details. """ -# System path configuration +import sys, logging -import sys +# Path to MoinMoin package, needed if you installed with --prefix=PREFIX +# or if you did not use setup.py. +#sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages') # Path of the directory where wikiconfig.py is located. # YOU NEED TO CHANGE THIS TO MATCH YOUR SETUP. sys.path.insert(0, '/path/to/wikiconfig') -# Path to MoinMoin package, needed if you installed with --prefix=PREFIX -# or if you did not use setup.py. -## sys.path.insert(0, 'PREFIX/lib/python2.3/site-packages') - # Path of the directory where farmconfig is located (if different). -## sys.path.insert(0, '/path/to/farmconfig') +#sys.path.insert(0, '/path/to/farmconfig') # Debug mode - show detailed error reports -## import os -## os.environ['MOIN_DEBUG'] = '1' - -# how many requests shall be handled by a moin fcgi process before it dies, -# -1 mean "unlimited lifetime": -max_requests = -1 +#import os +#os.environ['MOIN_DEBUG'] = '1' -# how many threads to use (1 means use only main program, non-threaded) -max_threads = 5 - -# backlog, use in socket.listen(backlog) call -backlog = 5 - - -# Code ------------------------------------------------------------------ - -# Do not touch unless you know what you are doing! -# TODO: move to server package? +from MoinMoin.server.server_fastcgi import FastCgiConfig, run -# Set threads flag, so other code can use proper locking -from MoinMoin import config -config.use_threads = max_threads > 1 -del config - -from MoinMoin.request import request_fcgi -from MoinMoin.support import thfcgi +class Config(FastCgiConfig): + loglevel_file = logging.DEBUG + logPath = 'moin.log' -def handle_request(req, env, form): - request = request_fcgi.Request(req, env, form) - # use this instead of the line above if your wiki runs under "/" url: - #request = request_fcgi.Request(req, env, form, properties={'script_name': '/'}) + properties = {} + # properties = {'script_name': '/'} # use this instead of the line above if your wiki runs under "/" url - request.run() +run(Config) -if __name__ == '__main__': - fcg = thfcgi.FCGI(handle_request, max_requests=max_requests, backlog=backlog, max_threads=max_threads) - fcg.run() -