Open bl0x opened 2 days ago
Hi @bl0x,
Adding a max_cache_age
parameter to app.add_static_files
and app.add_static_file
sounds like a great idea. Would you like to create a pull request?
Apart from that, I'm wondering why the technique from #588 doesn't work. Can you, by any chance, provide a minimum reproducible example demonstrating the problem? Thanks!
Description
I'm trying to write an app, where a GLTF file is procedurally generated via pythonOCC and then saved to a file. This file is subsequently loaded with ui.scene.gltf() to be displayed on screen. The user can make changes to how the file is generated through the app and the file is updated with the resulting changes to the geometry.
Since the filename stays the same, and the file is cached for 3600 seconds, updates to the file are not shown immediately in the app, which is not a nice user experience.
I've tried to work around this by applying this method: https://github.com/zauberzeug/nicegui/discussions/588, but it did not help.
What worked is to make a change here https://github.com/zauberzeug/nicegui/blob/24ee85a46cffed005fa6090de4f9c69ee6f807dc/nicegui/staticfiles.py#L10 and set
max-age
to1
instead of3600
.This is fine for my app, but of course not useful in the general case.
A useful extension might be to be able to specify
max-age
as an optional parameter for each static files mapping.