Add caching functionality via Flask-Caching
This commit is contained in:
@@ -26,6 +26,7 @@ from flask_security import SQLAlchemyUserDatastore, current_user, login_required
|
||||
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
|
||||
|
||||
from calsocial.account import AccountBlueprint
|
||||
from calsocial.cache import cache
|
||||
from calsocial.utils import RoutedMixin
|
||||
|
||||
|
||||
@@ -79,6 +80,8 @@ class CalendarSocialApp(Flask, RoutedMixin):
|
||||
|
||||
db.init_app(self)
|
||||
|
||||
cache.init_app(self)
|
||||
|
||||
babel = Babel(app=self)
|
||||
babel.localeselector(get_locale)
|
||||
|
||||
|
22
calsocial/cache.py
Normal file
22
calsocial/cache.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# Calendar.social
|
||||
# Copyright (C) 2018 Gergely Polonkai
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
"""Caching functionality for Calendar.social
|
||||
"""
|
||||
|
||||
from flask_caching import Cache
|
||||
|
||||
cache = Cache() # pylint: disable=invalid-name
|
@@ -14,3 +14,4 @@ SECRET_KEY = 'ThisIsNotSoSecret'
|
||||
SECURITY_PASSWORD_HASH = 'bcrypt'
|
||||
SECURITY_PASSWORD_SALT = SECRET_KEY
|
||||
SECURITY_REGISTERABLE = False
|
||||
CACHE_TYPE = 'simple'
|
||||
|
Reference in New Issue
Block a user