Commit ace0f203 authored by Bui's avatar Bui

cache /

parent d92cd6f3
...@@ -4,7 +4,6 @@ from __future__ import division ...@@ -4,7 +4,6 @@ from __future__ import division
import json import json
import sqlite3 import sqlite3
import tempfile
import re import re
import os import os
from flask import Flask, g, jsonify, render_template, request, abort, redirect from flask import Flask, g, jsonify, render_template, request, abort, redirect
...@@ -15,6 +14,7 @@ app = Flask(__name__) ...@@ -15,6 +14,7 @@ app = Flask(__name__)
try: try:
app.cache = Cache(app, config={'CACHE_TYPE': 'redis'}) app.cache = Cache(app, config={'CACHE_TYPE': 'redis'})
except RuntimeError: except RuntimeError:
import tempfile
app.cache = Cache(app, config={'CACHE_TYPE': 'filesystem', 'CACHE_DIR': tempfile.gettempdir()}) app.cache = Cache(app, config={'CACHE_TYPE': 'filesystem', 'CACHE_DIR': tempfile.gettempdir()})
DATABASE = 'taiko.db' DATABASE = 'taiko.db'
...@@ -150,6 +150,7 @@ def close_connection(exception): ...@@ -150,6 +150,7 @@ def close_connection(exception):
@app.route('/') @app.route('/')
@app.cache.cached(timeout=15)
def route_index(): def route_index():
version = get_version() version = get_version()
return render_template('index.html', version=version, config=get_config()) return render_template('index.html', version=version, config=get_config())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment