From ace0f2030c0ed4c6daee065ddc9762e90216dadf Mon Sep 17 00:00:00 2001 From: Bui Date: Thu, 14 Feb 2019 10:36:39 +0000 Subject: [PATCH] cache / --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 1a805b8..9d6ae49 100644 --- a/app.py +++ b/app.py @@ -4,7 +4,6 @@ from __future__ import division import json import sqlite3 -import tempfile import re import os from flask import Flask, g, jsonify, render_template, request, abort, redirect @@ -15,6 +14,7 @@ app = Flask(__name__) try: app.cache = Cache(app, config={'CACHE_TYPE': 'redis'}) except RuntimeError: + import tempfile app.cache = Cache(app, config={'CACHE_TYPE': 'filesystem', 'CACHE_DIR': tempfile.gettempdir()}) DATABASE = 'taiko.db' @@ -150,6 +150,7 @@ def close_connection(exception): @app.route('/') +@app.cache.cached(timeout=15) def route_index(): version = get_version() return render_template('index.html', version=version, config=get_config())