FastAPI · Class
StaticFiles
Use StaticFiles to serve CSS, JavaScript, images, and other files from a directory. Mount it at a URL prefix such as /static.
Last updated
Syntax
StaticFiles(*, directory=None, packages=None, html=False, check_dir=True, follow_symlink=False)
app.mount(path, StaticFiles(directory="static"), name="static")In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
FastAPI.mountStaticFiles.get_responseStaticFiles.lookup_pathJinja2Templatesurl_forapp.frontend()