mongkok / fastapi-debug-toolbar

A debug toolbar for FastAPI.
https://fastapi-debug-toolbar.domake.io
BSD 3-Clause "New" or "Revised" License
140 stars 14 forks source link

Static resource http 404 error under Windows system #52

Closed InPRTx closed 3 months ago

InPRTx commented 3 months ago

The same configuration does not have this problem on Debian OS: WIN11: Microsoft Windows [Version 10.0.22631.4037]

 Nekoha-Shizuku    Y:\test1   7.74s   6:06 PM   
 ⚡InPRTx ❯❯ pdm run
WARNING: No command is given, default to the Python REPL.
Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>
 ⚡InPRTx ❯❯ pdm run 1.py
INFO:     Started server process [25668]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO:     127.0.0.1:57991 - "GET / HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:57991 - "GET /favicon.ico HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:57991 - "GET /docs HTTP/1.1" 200 OK
INFO:     127.0.0.1:57991 - "GET /_debug_toolbar/static/css/toolbar.css HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:57994 - "GET /_debug_toolbar/static/js/toolbar.js HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:57995 - "GET /_debug_toolbar/static/js/refresh.js HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:57996 - "GET /_debug_toolbar/static/img/icon-white.svg HTTP/1.1" 404 Not Found
INFO:     127.0.0.1:57996 - "GET /openapi.json HTTP/1.1" 200 OK
INFO:     127.0.0.1:57995 - "GET /_debug_toolbar/static/css/print.css HTTP/1.1" 404 Not Found
 ⚡InPRTx ❯❯ pdm export --no-hashes
# This file is @generated by PDM.
# Please do not edit it manually.

annotated-types==0.7.0
anyio==4.4.0
click==8.1.7
colorama==0.4.6; platform_system == "Windows"
fastapi==0.112.1
fastapi-debug-toolbar==0.6.3
h11==0.14.0
idna==3.8
jinja2==3.1.4
markupsafe==2.1.5
pydantic==2.8.2
pydantic-core==2.20.1
pydantic-extra-types==2.9.0
pydantic-settings==2.4.0
pyinstrument==4.7.2
python-dotenv==1.0.1
sniffio==1.3.1
sqlparse==0.5.1
starlette==0.38.2
typing-extensions==4.12.2
uvicorn==0.30.6
 ⚡InPRTx ❯❯ cat .\1.py
from debug_toolbar.middleware import DebugToolbarMiddleware
from fastapi import FastAPI

app = FastAPI(debug=True)
app.add_middleware(DebugToolbarMiddleware)

if __name__ == '__main__':
    import uvicorn

    uvicorn.run(app, )

image

InPRTx commented 3 months ago

It was my problem. I used install.cache of pdm. I needed to change install.cache_method to hardlink to fix the problem.