| from fasthtml.common import * |
|
|
| app = FastHTML() |
| rt = app.route |
|
|
| style=""" |
| #mapid { height: 640px; } |
| """ |
|
|
| js = """ |
| function load() |
| { |
| var map = L.map('mapid').setView([ 37.5158, 127.0991], 13); |
| L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| maxZoom: 19, |
| attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' |
| }).addTo(map); |
| //alert('loading...'); |
| } |
| setTimeout(load, 1000); |
| """ |
|
|
| @rt('/') |
| def get(): |
| return Titled("MinorityMap", |
| Link(rel="stylesheet", href="https://unpkg.com/leaflet@1.4.0/dist/leaflet.css"), |
| Style(style), |
| Script(src="https://unpkg.com/leaflet@1.4.0/dist/leaflet.js"), |
| |
| Div(id='mapid'), |
| Script(js) |
| ) |
|
|
| serve() |
|
|