-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.py
executable file
·84 lines (75 loc) · 2.11 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
80
81
82
83
84
from dash import Dash, _dash_renderer
import dash
import dash_bootstrap_components as dbc
import dash_mantine_components as dmc
import logging
# Set the React version to 18.2.0
# https://www.dash-mantine-components.com/getting-started#simple-usage
_dash_renderer._set_react_version("18.2.0")
logging.getLogger().setLevel(logging.INFO)
external_stylesheets = [
dbc.themes.DARKLY,
dbc.icons.BOOTSTRAP,
dbc.icons.FONT_AWESOME
]
external_scripts = [
'https://cdn.jsdelivr.net/npm/@turf/turf@6/turf.min.js' # Turf.js for convex hulls
]
# Create the app
app = Dash(
external_scripts = external_scripts,
external_stylesheets = external_stylesheets,
name = __name__,
# Add meta tags for mobile devices
# https://community.plotly.com/t/reorder-website-for-mobile-view/33669/5?
meta_tags = [
{"name": "viewport", "content": "width=device-width, initial-scale=1"}
],
use_pages = True,
)
# Set the page title
app.title = "WhereToLive.LA"
app.description = "An interactive map of available rental & for-sale properties in Los Angeles County."
# For Gunicorn
server = app.server
# Plausible privacy-friendly analytics
# https://dash.plotly.com/external-resources#usage (Option 1)
# Probably won't get past adblockers and NoScript but whatever, good enough
app.index_string = """<!DOCTYPE html>
<html>
<head>
<script defer data-domain="wheretolive.la" src="https://plausible.automateordie.io/js/plausible.js" type="application/javascript"></script>
{%metas%}
<title>{%title%}</title>
{%favicon%}
{%css%}
</head>
<body>
{%app_entry%}
<footer>
{%config%}
{%scripts%}
{%renderer%}
</footer>
</body>
</html>
"""
app.layout = dmc.MantineProvider(
dbc.Container([
dbc.Row( # Second row: the rest
[
dash.page_container
],
# Remove the whitespace/padding between the two cards (aka the gutters)
# https://stackoverflow.com/a/70495385
className="g-0",
),
#html.Link(href='/assets/style.css', rel='stylesheet'),
],
fluid = True,
className = "dbc",
),
forceColorScheme="dark"
)
if __name__ == '__main__':
app.run_server(debug=True)