This commit is contained in:
Bui 2019-02-14 10:36:39 +00:00
parent d92cd6f3a2
commit ace0f2030c

3
app.py
View File

@ -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__)
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):
@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())