fix
This commit is contained in:
@ -74,8 +74,11 @@ app = FastAPI(
|
|||||||
lifespan=lifespan
|
lifespan=lifespan
|
||||||
)
|
)
|
||||||
|
|
||||||
# Mount static files
|
# Mount static files if directory exists
|
||||||
app.mount("/static", StaticFiles(directory="static"), name="static")
|
if os.path.exists("static"):
|
||||||
|
app.mount("/static", StaticFiles(directory="static"), name="static")
|
||||||
|
else:
|
||||||
|
print("Warning: 'static' directory not found, static files will not be served")
|
||||||
|
|
||||||
# Templates
|
# Templates
|
||||||
templates = Jinja2Templates(directory="templates")
|
templates = Jinja2Templates(directory="templates")
|
||||||
|
|||||||
13
web_viewer/static/README.md
Normal file
13
web_viewer/static/README.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Static Files Directory
|
||||||
|
|
||||||
|
This directory is for serving static files (CSS, JavaScript, images) through FastAPI.
|
||||||
|
|
||||||
|
Currently, all CSS and JavaScript is embedded directly in the HTML template for simplicity.
|
||||||
|
|
||||||
|
You can add files here if you want to separate them:
|
||||||
|
- `css/` - Stylesheets
|
||||||
|
- `js/` - JavaScript files
|
||||||
|
- `images/` - Images and icons
|
||||||
|
- `fonts/` - Custom fonts
|
||||||
|
|
||||||
|
Files will be accessible at `http://localhost:5000/static/<filename>`
|
||||||
Reference in New Issue
Block a user