Skip to content

How to implement the static_files functionality in Kui? #72

Answered by abersheeran
sunjizheng asked this question in Q&A
Discussion options

You must be logged in to vote

You should use https://baize.aber.sh/asgi#router to combine Pages and Kui……

Also, you can use

@app.router.http("/static/{path:any}")
async def static_file():
    return Files(
        Path(__file__).absolute().parent,
        handle_404=HTMLResponse("404", status_code=404),
    )

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@abersheeran
Comment options

Answer selected by abersheeran
@sunjizheng
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants