diff --git a/i2p2www/__init__.py b/i2p2www/__init__.py index 16b272a994f90603433f4384870d6df9da684242..57975769bea8bbc851a22c8ac927ed7c611dc36f 100644 --- a/i2p2www/__init__.py +++ b/i2p2www/__init__.py @@ -5,6 +5,11 @@ from docutils.core import publish_parts import os.path import os +try: + from i2p2www import settings +except ImportError: + settings = None + ########### # Constants @@ -13,7 +18,11 @@ CURRENT_I2P_VERSION = '0.9.7.1' CANONICAL_DOMAIN = 'i2hq.srv.i2p2.de' -THIS_DOMAIN = CANONICAL_DOMAIN +THIS_DOMAIN = settings.THIS_DOMAIN if settings and hasattr(settings, 'THIS_DOMAIN') else CANONICAL_DOMAIN + +CACHE_CONFIG = settings.CACHE_CONFIG if settings and hasattr(settings, 'CACHE_CONFIG') else { + 'CACHE_DEFAULT_TIMEOUT': 600, + } BLOG_POSTS_PER_FEED = 10 BLOG_POSTS_PER_PAGE = 10 @@ -67,10 +76,7 @@ class MyFlask(Flask): app = application = MyFlask('i2p2www', template_folder=TEMPLATE_DIR, static_url_path='/_static', static_folder=STATIC_DIR) app.debug = bool(os.environ.get('APP_DEBUG', 'False')) babel = Babel(app, default_domain=DEFAULT_GETTEXT_DOMAIN) -cache = Cache(app, config={ - 'CACHE_DEFAULT_TIMEOUT': 600, - #'CACHE_TYPE': '', # See http://packages.python.org/Flask-Cache/#configuring-flask-cache - }) +cache = Cache(app, config=CACHE_CONFIG) ################# diff --git a/i2p2www/settings.py.sample b/i2p2www/settings.py.sample new file mode 100644 index 0000000000000000000000000000000000000000..8284d6fc0f9679ac8f3796cab1a21f4f6389cd84 --- /dev/null +++ b/i2p2www/settings.py.sample @@ -0,0 +1,8 @@ +# The domain hosting this site +THIS_DOMAIN = 'i2p.mirror.example.org' + +# Flask-Cache settings +CACHE_CONFIG = { + 'CACHE_DEFAULT_TIMEOUT': 600, + 'CACHE_TYPE': '', # See http://packages.python.org/Flask-Cache/#configuring-flask-cache + }