config=current_app.config['Cache']) @classmethod def set(cls, key: str, value: str, timeout: int = 600): if not cls.instance.has(key): cls.instance.set(key, value, timeout=timeout) @classmethod def get(cls, key: str): return cls.instance.get...
app.permanent_session_lifetime = timedelta(minutes=10) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///users.sqlite3' app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False db = SQLAlchemy(app) ... if __name__ == "__main__": db.create_all() app.run(debug=True) Myrequirements....
from flask import current_app class Cache: instance = FlaskCache(current_app, config=current_app.config['Cache']) @classmethod def set(cls, key: str, value: str, timeout: int = 600): if not cls.instance.has(key): cls.instance.set(key, value, timeout=timeout) @classmethod def get(...