Skip to content

Commit

Permalink
Serve the static files
Browse files Browse the repository at this point in the history
  • Loading branch information
fileformat committed Nov 4, 2024
1 parent 23f0a9a commit 38508be
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 0 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ USER nonroot

WORKDIR /app/dist
COPY --chown=nonroot:nonroot ./src /app/dist
COPY --chown=nonroot:nonroot ./static /app/dist/static
COPY --chown=nonroot:nonroot --from=build /app/.venv/lib/python3.12/site-packages /app/dist

# in slim-bookworm: "/usr/local/bin/python3.12"
Expand Down
13 changes: 13 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import sysconfig
import sys
from quart import Quart, request
from quart.helpers import send_file
from markupsafe import escape

app = Quart(__name__)
Expand All @@ -38,6 +39,18 @@ def handle_jsonp(data):
async def root():
return f"Running Python {platform.python_version()}", 200, { "Content-Type": "text/plain; charset=utf8;" }

@app.route("/favicon.ico")
async def faviconIco():
return await send_file("static/favicon.ico")

@app.route("/favicon.svg")
async def faviconSvg():
return await send_file("static/favicon.svg")

@app.route("/robots.txt")
async def robotsTxt():
return await send_file("static/robots.txt")

@app.route("/status.json")
async def status_json():
retVal = {}
Expand Down
Binary file added static/favicon.ico
Binary file not shown.
Loading

0 comments on commit 38508be

Please sign in to comment.