Improve caching

This commit is contained in:
Ondřej Nývlt 2023-08-21 10:43:25 +02:00
parent 6cccea04fb
commit f17dadd5a3

View file

@ -1,7 +1,7 @@
#!/usr/bin/python3
import sqlite3
from flask import Flask, request, render_template, g, send_from_directory
from flask import Flask, make_response, request, render_template, g, send_from_directory
from flask_paginate import Pagination, get_page_parameter
import confuse
import re
@ -83,7 +83,7 @@ def index():
)
diffs = db.fetchall()
return render_template(
html = render_template(
"./index.html",
diffs=diffs,
page=page,
@ -93,6 +93,11 @@ def index():
expand_diffs=expand_diffs,
)
res = make_response(html)
res.cache_control.max_age = 60
res.cache_control.public = True
return res
@app.route("/article/<path:article_id>")
def article_detail(article_id: str):