Mercurial > wikked
changeset 255:c27317412100
Re-added the WSGI utility module.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Wed, 02 Apr 2014 19:23:19 -0700 |
parents | fa2c3671bcd9 |
children | 5667f11fd7c9 |
files | wikked/wsgiutil.py |
diffstat | 1 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/wikked/wsgiutil.py Wed Apr 02 19:23:19 2014 -0700 @@ -0,0 +1,23 @@ +import logging +import wikked.settings + + +logger = logging.getLogger() + + +def get_wsgi_app(wiki_root=None, async_update=True, log_file=None, + max_log_bytes=0, log_backup_count=0, log_level=logging.INFO): + if log_file: + from logging.handlers import RotatingFileHandler + handler = RotatingFileHandler(log_file, maxBytes=max_log_bytes, + backupCount=log_backup_count) + handler.setLevel(log_level) + logging.getLogger().addHandler(handler) + + logger.debug("Creating WSGI application.") + if wiki_root: + wikked.settings.WIKI_ROOT = wiki_root + wikked.settings.WIKI_ASYNC_UPDATE = async_update + from wikked.web import app + return app +