-
Notifications
You must be signed in to change notification settings - Fork 4
/
app.py
79 lines (65 loc) · 2.45 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 2021-2024 AstroLab Software
# Author: Julien Peloton
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import dash
import dash_bootstrap_components as dbc
from dash.long_callback import DiskcacheLongCallbackManager
from dash import DiskcacheManager
# import jpype
import os
import yaml
import diskcache
dash._dash_renderer._set_react_version("18.2.0")
cache = diskcache.Cache("./cache")
long_callback_manager = DiskcacheLongCallbackManager(cache)
background_callback_manager = DiskcacheManager(cache)
args = yaml.load(open("config.yml"), yaml.Loader)
APIURL = args["APIURL"]
LOCALAPI = args.get("LOCALAPI", False)
# bootstrap theme
external_stylesheets = [
dbc.themes.SPACELAB,
"//use.fontawesome.com/releases/v5.7.2/css/all.css",
"https://unpkg.com/@mantine/dates@7/styles.css",
"https://unpkg.com/@mantine/code-highlight@7/styles.css",
"https://unpkg.com/@mantine/charts@7/styles.css",
"https://unpkg.com/@mantine/carousel@7/styles.css",
"https://unpkg.com/@mantine/notifications@7/styles.css",
"https://unpkg.com/@mantine/nprogress@7/styles.css",
]
external_scripts = [
"//code.jquery.com/jquery-1.12.1.min.js",
"//aladin.u-strasbg.fr/AladinLite/api/v3/3.2.0/aladin.js",
"//cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js",
]
# Enable verbose logging on callbacks, if requested
if "DASH_TELEMETRY" in os.environ:
from telemetry import DashWithTelemetry
factory = DashWithTelemetry
else:
factory = dash.Dash
app = factory(
__name__,
external_stylesheets=external_stylesheets,
external_scripts=external_scripts,
meta_tags=[{"name": "viewport", "content": "width=device-width, initial-scale=1"}],
long_callback_manager=long_callback_manager,
background_callback_manager=background_callback_manager,
update_title=None,
title="Fink Science Portal",
)
nlimit = 10000
app.server.config["MAX_CONTENT_LENGTH"] = 100 * 1024 * 1024
server = app.server
app.config.suppress_callback_exceptions = True