Added map
Browse files
main.py
CHANGED
|
@@ -3,8 +3,25 @@ from fasthtml.common import *
|
|
| 3 |
app = FastHTML()
|
| 4 |
rt = app.route
|
| 5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
@rt('/')
|
| 7 |
def get():
|
| 8 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
| 10 |
serve()
|
|
|
|
| 3 |
app = FastHTML()
|
| 4 |
rt = app.route
|
| 5 |
|
| 6 |
+
style="""
|
| 7 |
+
#map { height: 180px; }
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
js = """
|
| 11 |
+
var map = L.map('mapid').setView([51.505, -0.09], 13);
|
| 12 |
+
L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
| 13 |
+
maxZoom: 19,
|
| 14 |
+
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
|
| 15 |
+
}).addTo(map);
|
| 16 |
+
"""
|
| 17 |
+
|
| 18 |
@rt('/')
|
| 19 |
def get():
|
| 20 |
+
return Titled("MinorityMap",
|
| 21 |
+
Link(rel="stylesheet", href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css"),
|
| 22 |
+
Style(style),
|
| 23 |
+
Script(src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"), Div(id='mapid'),
|
| 24 |
+
Script(src=js)
|
| 25 |
+
)
|
| 26 |
|
| 27 |
serve()
|