mirror of
https://git.nolog.cz/NoLog.cz/headline.git
synced 2025-01-31 11:53:35 +01:00
Improve caching
This commit is contained in:
parent
6cccea04fb
commit
f17dadd5a3
1 changed files with 7 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
import sqlite3
|
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
|
from flask_paginate import Pagination, get_page_parameter
|
||||||
import confuse
|
import confuse
|
||||||
import re
|
import re
|
||||||
|
@ -83,7 +83,7 @@ def index():
|
||||||
)
|
)
|
||||||
diffs = db.fetchall()
|
diffs = db.fetchall()
|
||||||
|
|
||||||
return render_template(
|
html = render_template(
|
||||||
"./index.html",
|
"./index.html",
|
||||||
diffs=diffs,
|
diffs=diffs,
|
||||||
page=page,
|
page=page,
|
||||||
|
@ -93,6 +93,11 @@ def index():
|
||||||
expand_diffs=expand_diffs,
|
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>")
|
@app.route("/article/<path:article_id>")
|
||||||
def article_detail(article_id: str):
|
def article_detail(article_id: str):
|
||||||
|
|
Loading…
Reference in a new issue