changeset 4271:793bf51b6c76

Added SCGI adapter
author Florian Krupicka <florian.krupicka@googlemail.com>
date Wed, 06 Aug 2008 23:27:13 +0200
parents ab601d804f26
children 0b5f28e79da7
files MoinMoin/web/scgi_interface.py wiki/server/moin.scgi
diffstat 2 files changed, 66 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MoinMoin/web/scgi_interface.py	Wed Aug 06 23:27:13 2008 +0200
@@ -0,0 +1,32 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - SCGI interface
+
+    @copyright: 2008 MoinMoin:FlorianKrupicka
+    @license: GNU GPL, see COPYING for details.
+"""
+import optparse
+
+from MoinMoin.web.frontend import ServerFrontEnd
+
+from MoinMoin import log
+logging = log.getLogger(__name__)
+
+class SCGIFrontEnd(ServerFrontEnd):
+    def run_server(self, application, options):
+        from flup.server.scgi import WSGIServer
+
+        kwargs = {}
+        if options.port:
+            kwargs['bindAddress'] = (options.interface, options.port)
+        elif options.interface.startswith('/') or \
+                options.interface.startswith('./'):
+            kwargs['bindAddress'] = options.interface
+
+        WSGIServer(application, **kwargs).run()
+
+def run():
+    SCGIFrontEnd().run()
+
+if __name__ == '__main__':
+    run()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wiki/server/moin.scgi	Wed Aug 06 23:27:13 2008 +0200
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - SCGI Driver script
+
+    @copyright: 2008 by MoinMoin:FlorianKrupicka
+    @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')
+
+from MoinMoin.web.scgi_interface import run
+
+run()