Update web.py

route /cache to admin clear cache without restart the server
This commit is contained in:
Webysther Sperandio 2023-05-24 15:27:28 +02:00 committed by GitHub
parent 3b4b0277e2
commit 193afd71b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -1632,3 +1632,10 @@ def show_book(book_id):
flash(_("Oops! Selected book is unavailable. File does not exist or is not accessible"),
category="error")
return redirect(url_for("web.index"))
@web.route('/cache', methods=['GET'])
def clear_cache():
if current_user.role_admin():
get_books.cache_clear()
return redirect(url_for('web.index'))