annotate MoinMoin/server/server_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 b902f2397c68
children ed1a433803c6 806cf4814612
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2338
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
1 """
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
2 MoinMoin - WSGI application
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
3
3015
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
4 Minimal code for using this:
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
5
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
6 import logging
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
7 from MoinMoin.server.server_wsgi import WsgiConfig, moinmoinApp
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
8
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
9 class Config(WsgiConfig):
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
10 logPath = 'moin.log' # define your log file here
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
11 #loglevel_file = logging.INFO # if you do not like the default
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
12
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
13 config = Config() # you MUST create an instance to initialize logging!
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
14 # use moinmoinApp here with your WSGI server / gateway
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
15
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
16 @copyright: 2005 Anakim Border <akborder@gmail.com>,
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
17 2007 MoinMoin:ThomasWaldmann
2338
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
18 @license: GNU GPL, see COPYING for details.
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
19 """
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
20
3015
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
21 from MoinMoin.server import Config
2338
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
22 from MoinMoin.request import request_wsgi
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
23
3015
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
24 class WsgiConfig(Config):
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
25 """ WSGI default config """
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
26 loglevel_stderr = None # we do not want to write to stderr!
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
27
8d691fbdc929 WSGI: initialize logging (untested) (port from 1.6)
Thomas Waldmann <tw AT waldmann-edv DOT de>
parents: 2338
diff changeset
28
2338
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
29 def moinmoinApp(environ, start_response):
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
30 request = request_wsgi.Request(environ)
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
31 request.run()
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
32 start_response(request.status, request.headers)
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
33 return [request.output()]
b902f2397c68 rename server and request Implementations by adding a prefix server_, request_
Reimar Bauer <rb.proj AT googlemail DOT com>
parents:
diff changeset
34