-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
85 lines (75 loc) · 2.52 KB
/
app.py
File metadata and controls
85 lines (75 loc) · 2.52 KB
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
80
81
82
83
84
85
"""
Waveplot: An online wavefunction viewer
Copyright (C) 2023 Jon G. C. Kragskow
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
"""
import dash
import flask
# external scripts
external_scripts = [
"https://code.jquery.com/jquery-3.6.3.min.js",
"https://kit.fontawesome.com/aec084d2c4.js"
]
app = dash.Dash(
__name__,
external_stylesheets=[
"https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" # noqa
],
external_scripts=external_scripts,
suppress_callback_exceptions=False,
meta_tags=[
{
"name": "viewport",
"content": "width=device-width, initial-scale=0.75"
}
],
use_pages=True
)
# Certificate http01 challenge
@app.server.route("/.well-known/acme-challenge/<path:filename>")
def http01_respond(filename):
return flask.send_file(
"../../public/.well-known/acme-challenge/{}".format(filename)
)
# Change header
# %thing% are defined by dash and are replaced at runtime
app.index_string = r"""
<!DOCTYPE html>
<html>
<head>
{%metas%}
<title>Waveplot</title>
<meta name="description" content="Online wavefunction viewer">
<meta name="keywords" content="Online wavefunction viewer">
<meta name="author" content="Jon Kragskow">
{%favicon%}
{%css%}
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZLSP2ZF2HN"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-ZLSP2ZF2HN');
</script>
</head>
<body>
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>
""" # noqa
server = app.server