Hi! I managed to change the theme of my app while building it in my local host. When I deploy this on Heroku, should I include the config.toml I used locally so that the deployed app will have the theme settings I want?
Yes put it in .streamlit/config.toml
and make sure it is deployed.
Thank you for answering, but I’m not sure I get what you mean.
I got it, thank you. I put this in my setup.sh:
mkdir -p ~/.streamlit/
echo "[theme]
primaryColor = ‘#84a3a7’
backgroundColor = ‘#EFEDE8’
secondaryBackgroundColor = ‘#fafafa’
textColor= ‘#424242’
font = ‘sans serif’
[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml
I haven’t used Heroku, but this seems to be the right way to go, according to this article:
https://towardsdatascience.com/quickly-build-and-deploy-an-application-with-streamlit-988ca08c7e83
Hi @Phoemela_Ballaran -
Here is an example of having a file in your repo, so that you don’t have to dynamically create anything:
Create a folder labelled .streamlit
in your code repo, then place the config.toml
file in it. Commit it to GitHub and it will exist in your repo when you deploy it.
Best,
Randy
That’s so cool! Thanks @randyzwitch !
I am doing as said in this post but after deployment the theme is set to default and not the custom selected one ,what should I do ?
hello , after 12hours of trying on my confg.toml i fined that there’s a difference between " and ’ :
so try :
mkdir -p ~/.streamlit/
echo "[theme]
primaryColor=’#020202’
backgroundColor=’#c4c3c3’
secondaryBackgroundColor=’#ebd316’
font = ‘sans serif’
[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml
i hope that this will help you .
It actually worked
Thanks a bunch, it really helped!
nice
nice , it’s nothing
Yes I had created .Streamlit/config.toml
On local machine the theme is changing but deploying on heroku it doesn’t work
Oh thanks man it’s working!!!
Thanks! This works great for me.
For my case, I wanted to have a config.toml
file locally as well to test the theme in localhost.
After many hours wasted not understanding why the theme is not applied when deployed on heroku, it turns out that in the setup.sh
the command which adds the [server] information to config.toml
was overwriting the file. It was using >
instead of >>
. Now my setup.sh
file looks like this and it works:
mkdir -p ~/.streamlit/
echo "\
[general]\n\
email = \"your-email@domain.com\"\n\
" > ~/.streamlit/credentials.toml
echo "[server]
headless = true
port = $PORT
enableCORS = false
" >> ~/.streamlit/config.toml
Hope it helps!
Thanks
Thanks a lot! It worked for me
mkdir -p ~/.streamlit/
echo "[theme]
primaryColor = ‘#84a3a7’
backgroundColor = ‘#EFEDE8’
secondaryBackgroundColor = ‘#fafafa’
textColor= ‘#424242’
font = ‘sans serif’
[server]
headless = true
port = $PORT
enableCORS = false
" > ~/.streamlit/config.toml
It is not working. kindly help
I created a streamlit.io account just to thank you for your comment!