I just made my website using streamlit and have uploaded it to heroku. I have a config.toml file in the.streamlit folder, which changes the text colour and background colour of the website.
On running it by using the streamlit run
command, it works perfectly fine. But using heroku and going to the provided website, the text colour there seems to be black and the background white, which are not the correct colours.
Here is my setup.sh
file:
mkdir -p ~/.streamlit/
echo "\
[general]\n\
email = \"myname@domain.com\"\n\
" > ~/.streamlit/credentials.toml
echo "\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
" > ~/.streamlit/config.toml
Here is my config.toml
file:
[theme]
primaryColor = '#eb4034'
backgroundColor = '#021d24'
secondaryBackgroundColor = '#B9F1C0'
textColor = '#FFFFFF'
font = "sans serif"
Here is my
config.toml
file
I'm not sure where that content comes from, but it won't be in your config.toml
on Heroku because you create or overwrite that file in your setup.sh
.
echo
ing stuff and redirecting it into a file using >
overwrites what's already there.
If that file already exists (unlikely on Heroku, but I'm not familiar with Streamlit so maybe it gets generated somehow), change >
to >>
so you append to the existing file instead:
echo "\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
" >> ~/.streamlit/config.toml # <-- Here
Or, add the [theme]
section to your setup.sh
(note the change to single quotes around #FFFFFF
):
echo "\
[server]\n\
headless = true\n\
enableCORS=false\n\
port = $PORT\n\
\n\
[theme]\n\
primaryColor = '#eb4034'\n\
backgroundColor = '#021d24'\n\
secondaryBackgroundColor = '#B9F1C0'\n\
textColor = '#FFFFFF'\n\
font = 'sans serif'\n\
" > ~/.streamlit/config.toml
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.