From 478b2feb875e4ef5a458531c0d24f0b2117f5490 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Sat, 2 Jan 2016 15:05:53 +0100 Subject: better thumbs, better caching (with filesystem) --- mediabrowser/wsgi.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mediabrowser/wsgi.py') diff --git a/mediabrowser/wsgi.py b/mediabrowser/wsgi.py index 038ca5b..4091b7b 100644 --- a/mediabrowser/wsgi.py +++ b/mediabrowser/wsgi.py @@ -1,7 +1,7 @@ import mediabrowser from flask import Flask -from werkzeug.contrib.cache import SimpleCache +from werkzeug.contrib.cache import FileSystemCache import os import logging @@ -10,7 +10,12 @@ logging.basicConfig(level=logging.INFO) root = os.getenv("MEDIABROWSER_ROOT") if not root: raise Exception('Must set MEDIABROWSER_ROOT variable') -cache = SimpleCache() +cache_dir = os.getenv("MEDIABROWSER_CACHEDIR") +if not cache_dir: + raise Exception('Must set MEDIABROWSER_CACHEDIR variable') + +# default_timeout=0 doesn't work with FileSystemCache +cache = FileSystemCache(cache_dir, default_timeout=9999999999, threshold=5000) application = Flask("mediabrowser-demo") application.register_blueprint(mediabrowser.build(root, cache)) -- cgit v1.2.1