gio 7 년 전
부모
커밋
8cad260eee
2개의 변경된 파일37개의 추가작업 그리고 4개의 파일을 삭제
  1. 4 4
      server.py
  2. 33 0
      views/map_template.tpl

+ 4 - 4
server.py

@@ -4,12 +4,12 @@ from bottle import route, run,template
 @route('/myapp')
 @route('/myapp/')
 def myApp():
-    return '<b style="color:green">Hello Sandeep .Bottle Framework demonstration route.</b>'
+    return template('map_template', item=item)
 
 
-@route('/myapp/<name>')
-def myName(name):
-    return template('<b style="color:green">Hello <b style="color:red"> {{name}}</b>. Bottle Framework demonstration route with template string.', name=name)
+@route('/myapp/<item>')
+def myName(item):
+    return template('map_template', item=item)
 
 
 @route('/myapp/favourite/')

+ 33 - 0
views/map_template.tpl

@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Quick Start - Leaflet</title>
+
+  <meta charset="utf-8" />
+  <meta name="viewport" content="width=device-width, initial-scale=1.0">
+  
+  <link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />
+
+  <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" />
+  <script src="https://unpkg.com/leaflet@1.0.3/dist/leaflet.js"></script>
+  </head>
+  <body>
+    
+    <div id="mapid" style="width: 600px; height: 400px;"></div>
+<script>
+
+  var mymap = L.map('mapid').setView([44.4936714,11.3430347], 13);
+
+  L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token=pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpandmbXliNDBjZWd2M2x6bDk3c2ZtOTkifQ._QA7i5Mpkd_m30IGElHziw', {
+    maxZoom: 18,
+    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
+      '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
+      'Imagery © <a href="http://mapbox.com">Mapbox</a>',
+    id: 'mapbox.streets'
+  }).addTo(mymap);
+  var marker = L.marker([44.5038497,11.3139989]).addTo(mymap);
+  marker.bindPopup("<b>Ospedale Maggiore</b><br>{{item}} barbone").openPopup();
+  
+</script>
+  </body>
+</html>