Public directory attached to the root URL

develop
orzo 12 months ago
parent 969dc04304
commit 51720a397f
  1. 2
      client/public/index.html
  2. 10
      server/main.py
  3. 6
      server/public/index.html

@ -8,7 +8,7 @@
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" />
<link rel="stylesheet" href="index.css">
<script src="/public/vendor/vue.min.js"></script>
<script src="/vendor/vue.min.js"></script>
<title>Map</title>
</head>

@ -7,14 +7,14 @@ dir = os.path.dirname(__file__)
routes = web.RouteTableDef()
app = web.Application()
app.router.add_static("/public/",
app.router.add_static("/",
path=os.path.join(dir, "public"),
name="public")
@routes.get("/")
async def index(request):
async with aiofiles.open(os.path.join(dir, "public", "index.html")) as conn:
return web.Response(text=await conn.read(), content_type="text/html")
# @routes.get("/")
# async def index(request):
# async with aiofiles.open(os.path.join(dir, "public", "index.html")) as conn:
# return web.Response(text=await conn.read(), content_type="text/html")
@routes.get("/data/{resource}")

@ -6,9 +6,9 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css" integrity="sha512-xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A==" crossorigin="" />
<link rel="stylesheet" href="/public/index.css">
<link rel="stylesheet" href="/index.css">
<script src="/public/vendor/vue.min.js"></script>
<script src="/vendor/vue.min.js"></script>
<title>Map</title>
</head>
@ -18,7 +18,7 @@
</body>
<script src="https://unpkg.com/leaflet@1.7.1/dist/leaflet.js" integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA==" crossorigin=""></script>
<script src="/public/index.js"></script>
<script src="/index.js"></script>

Loading…
Cancel
Save