Skip to content

Commit

Permalink
Add supported storage to readme, update example
Browse files Browse the repository at this point in the history
  • Loading branch information
Lxstr committed Feb 21, 2024
1 parent e67708d commit 519f754
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 8 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ A Simple Example
def get():
return session.get('key', 'not set')
Supported Storage Types
------------------------
- Redis
- Memcached
- FileSystem
- MongoDB
- SQLALchemy

Documentation
-------------
Learn more at the official `Flask-Session Documentation <https://flask-session.readthedocs.io/en/latest/>`_.
Expand Down
2 changes: 1 addition & 1 deletion docs/config_exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Redis example with retries on certain errors:
)
retry = Retry(ExponentialBackoff(), 3)
r = Redis(host='localhost', port=6379, retry=retry, retry_on_error=[BusyLoadingError, ConnectionError, TimeoutError])
SESSION_REDIS = Redis(host='localhost', port=6379, retry=retry, retry_on_error=[BusyLoadingError, ConnectionError, TimeoutError])
Logging
Expand Down
9 changes: 6 additions & 3 deletions examples/hello.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
app.config.update(
{
"SESSION_TYPE": "redis",
"FLASK_ENV": "production",
}
)
Session(app)
Expand All @@ -27,11 +26,15 @@ def get():

@app.route("/delete/")
def delete():
# del session["key"]
raise RedisError("test")
del session["key"]
return "deleted"


@app.route("/error/")
def error():
raise RedisError("An error occurred with Redis")


@app.errorhandler(RedisError)
def handle_redis_error(error):
app.logger.error(f"Redis error encountered: {error}")
Expand Down

0 comments on commit 519f754

Please sign in to comment.