diff options
author | Yves Fischer <yvesf-git@xapek.org> | 2016-01-02 15:05:53 +0100 |
---|---|---|
committer | Yves Fischer <yvesf-git@xapek.org> | 2016-01-08 20:38:18 +0100 |
commit | 478b2feb875e4ef5a458531c0d24f0b2117f5490 (patch) | |
tree | 799ff53e65e3992424e190ee4201500a8862eb71 /mediabrowser/wsgi.py | |
parent | d63cdea1618f3e493a966ce43fb735b0afc098b6 (diff) | |
download | flask-mediabrowser-478b2feb875e4ef5a458531c0d24f0b2117f5490.tar.gz flask-mediabrowser-478b2feb875e4ef5a458531c0d24f0b2117f5490.zip |
better thumbs, better caching (with filesystem)
Diffstat (limited to 'mediabrowser/wsgi.py')
-rw-r--r-- | mediabrowser/wsgi.py | 9 |
1 files changed, 7 insertions, 2 deletions
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)) |