-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathapp.py
56 lines (49 loc) · 1.58 KB
/
app.py
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import BTrees.OOBTree
import dash
import dash_bootstrap_components as dbc
import ZODB
import ZODB.FileStorage
from log import setup_logger
from controller.cellar.utils.colors import PALETTE
# In-memory database. Used for storing AnnData objects
db = ZODB.DB(None)
connection = db.open()
dbroot = connection.root
dbroot.adatas = BTrees.OOBTree.BTree()
dbroot.MULTIPLEXER_OUTPUTS = BTrees.OOBTree.BTree()
dbroot.notifications = BTrees.OOBTree.BTree()
dbroot.palettes = BTrees.OOBTree.BTree()
dbroot.palettes['main'] = PALETTE.copy()
dbroot.palettes['side'] = PALETTE.copy()
# Bootstrap theme
external_stylesheets = [
dbc.themes.SANDSTONE,
{
'href': 'https://use.fontawesome.com/releases/v5.8.1/css/all.css',
'rel': 'stylesheet',
'integrity': 'sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML' +
'5d60M1M7uH2+nqUivzIebhndOJK28anvf',
'crossorigin': 'anonymous'
}
]
"""
Dash requires the knowledge of the path used to access the app.
ShinyProxy makes this path available as an environment variable,
which we expose to dash below.
"""
if 'SHINYPROXY_PUBLIC_PATH' in os.environ:
routes_pathname_prefix = os.environ['SHINYPROXY_PUBLIC_PATH']
requests_pathname_prefix = os.environ['SHINYPROXY_PUBLIC_PATH']
else:
routes_pathname_prefix = None
requests_pathname_prefix = None
app = dash.Dash(
__name__,
external_stylesheets=external_stylesheets,
title="Cellar",
suppress_callback_exceptions=True,
routes_pathname_prefix=routes_pathname_prefix,
requests_pathname_prefix=requests_pathname_prefix,
)
logger = setup_logger('Cellar')