-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
31 lines (25 loc) · 777 Bytes
/
app.py
File metadata and controls
31 lines (25 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import os
import dash
from redis import ConnectionError
from flask_caching import Cache
external_stylesheets = [
# Dash CSS
'css/styles.css',
# Loading screen CSS
'https://codepen.io/chriddyp/pen/brPBPO.css']
app = dash.Dash(__name__,
external_stylesheets=external_stylesheets)
server = app.server
# print('REDIS_URL', os.environ.get('REDIS_URL'))
CACHE_CONFIG = {
# try 'filesystem' if you don't want to setup redis
'CACHE_TYPE': 'redis',
'CACHE_REDIS_URL': os.environ.get('REDIS_URL', 'redis://localhost:6379')
}
cache_found = True
cache = Cache()
cache.init_app(app.server, config=CACHE_CONFIG)
try:
cache.set('noaa_storms_analysis', True, 1)
except ConnectionError:
cache_found = False