comparison wiki/server/moin_flup_wsgi.py @ 3015:8d691fbdc929

WSGI: initialize logging (untested) (port from 1.6)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sun, 06 Jan 2008 20:06:00 +0100
parents 70f2d676920b
children 806cf4814612
comparison
equal deleted inserted replaced
3014:dc970f2d146c 3015:8d691fbdc929
1 """ 1 """
2 MoinMoin - WSGI application 2 MoinMoin - Moin as WSGI application with flup as fcgi gateway
3 3
4 @copyright: 2005 by Anakim Border <akborder@gmail.com> 4 @copyright: 2005 by Anakim Border <akborder@gmail.com>,
5 2007 by MoinMoin:ThomasWaldmann
5 @license: GNU GPL, see COPYING for details. 6 @license: GNU GPL, see COPYING for details.
6 """ 7 """
7 8
8 use_threads = True 9 use_threads = True
9 unixSocketPath = '/tmp/moin.sock' 10 unixSocketPath = '/tmp/moin.sock'
11
12 import os
13 import logging
10 14
11 # Set threads flag, so other code can use proper locking 15 # Set threads flag, so other code can use proper locking
12 from MoinMoin import config 16 from MoinMoin import config
13 config.use_threads = use_threads 17 config.use_threads = use_threads
14 del config 18 del config
15 19
16 from flup.server.fcgi import WSGIServer 20 from flup.server.fcgi import WSGIServer
17 from MoinMoin.server.server_wsgi import moinmoinApp 21 from MoinMoin.server.server_wsgi import moinmoinApp, WsgiConfig
18 import os 22
23 class Config(WsgiConfig):
24 logPath = 'moin.log' # adapt to your needs!
25 #loglevel_file = logging.INFO # adapt to your needs!
26
27 config = Config() # MUST create an instance to init logging
19 28
20 if __name__ == '__main__': 29 if __name__ == '__main__':
21 server = WSGIServer(moinmoinApp, bindAddress=unixSocketPath) 30 server = WSGIServer(moinmoinApp, bindAddress=unixSocketPath)
22 server.run() 31 server.run()
23 os.unlink(unixSocketPath) 32 os.unlink(unixSocketPath)