当我运行 server.py 文件时出现错误
File "C:\Users\nawin\AppData\Local\Programs\Python\Python38\lib\site-packages\starlette\staticfiles.py", line 57, in __init__
raise RuntimeError(f"Directory '{directory}' does not exist")
RuntimeError: Directory 'app/static' does not exist
Run Code Online (Sandbox Code Playgroud)
服务器.py 文件
app = Starlette()
app.add_middleware(CORSMiddleware, allow_origins=['*'], allow_headers=['X-Requested-With', 'Content-Type'])
app.mount('/static', StaticFiles(directory='app/static'))
Run Code Online (Sandbox Code Playgroud)
python 版本 3.8 操作系统 Windows 10
python ×1