Setting favicon in browser?

I am having trouble setting a custom favicon to display in the browser. Following the tutorial on asset files (https://solara.dev/docs/reference/asset-files), I have a directory called assets in my app repository which contains the icon favicon.png. It also has a custom.css file, which doesn't seem to be loading, either. My assumption is when running Solara server, these files would be automatically noticed and override defaults, but maybe I'm misunderstanding something. Any suggestions? Thanks!
3 Replies
MaartenBreddels
MaartenBreddels10mo ago
Yes, that should work, if this is not working, maybe your directory layout is not as expected, make sure your assets are in ../assets/
iisakkirotko
iisakkirotko10mo ago
I will take a better look at this tomorrow, but I wasn't able to get this working quickly today either Probably it is as @MaartenBreddels said. The assets folder should be a directory above the app you are running.
Cyrus
Cyrus3mo ago
@MaartenBreddels I am having the same issue. favicon is still the default and the style only gets picked up if I add solara.Style('/my/local/path/to/style.css') to my pages.__init__.py. My directory structure currently looks something like
myproject/
run-ui.sh <-- calls `solara run myapp/pages`
myapp/
components/...
pages/
__init__.py
page1.py
...
assets/
favicon.ico
style.css
myproject/
run-ui.sh <-- calls `solara run myapp/pages`
myapp/
components/...
pages/
__init__.py
page1.py
...
assets/
favicon.ico
style.css
I am also using a pyproject.toml to install the myapp package. Am I missing something? I tried moving assets one level up but that did not work either
Want results from more Discord servers?
Add your server