-
Notifications
You must be signed in to change notification settings - Fork 144
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix assets to work when hosted at subdirectory #151
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! Couple of QQ
vizro-core/changelog.d/20231108_230816_antony.milne_fix_assets_pathname.md
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG from my side!
This looks great - thanks for fixing and solving the mystery! 🚀 🔥 Looks very clean now - I also like that you don't have to provide an absolute path to the |
Description
A Vizro dashboard might be accessible through 3 different sorts of route:
Before this change: 1 and 2 already worked correctly but 3 did not.
Now: all should work correctly.
I've tested 1, will test 2 soon. @maxschulz-COL please can you test 3? I've bumped the version here to
0.1.6.dev2
so you can check you're using the right version when you deploy.Important
We now have a "proper" way to alter
assets_folder
from its default rather than going throughVizro._user_assets_folder
, since I've exposed**kwargs
inVizro()
.Here's the rules for how we should write code so that paths are always correctly formed:
dash.get_relative_path
to link to pages withhref
(see_make_page_404_layout
example link)dash.get_relative_path(f"/{STATIC_URL_PREFIX}/..")
to refer to built-in assets in thestatic
folder (see_make_page_404_layout
examplehtml.Img
)dash.get_asset_url
to refer to things in the userassets
folder (we don't have any examples of this at the moment outside docs)Still to do:
**kwargs
inVizro.__init__
Checklist
Types of changes
Notice
I acknowledge and agree that, by checking this box and clicking "Submit Pull Request":