Config.toml do not work after deployed

Hi,
I change the background color in config.toml.
It works just fine locally, however the color does not change after being deployed in share.streamlit.io.

my app repo

Anyone can help? Thanks in advance.

I assume that the streamlit cloud runtime expects the .streamlit/config.toml path in the root folder, but you have it nested in a subfolder, relative to the streamlit app.

  • Running streamlit apps from subfolders cause quite often problems on streamlit cloud, because the paths seems to be wrecked.
  • If you want to address parent folders, it gets even more complicated.
  • I would generally recommend to use only one streamlit project per github repo and always work from the root folder.
1 Like

Solved!
One thousand thanks. :slight_smile:

Not exactly.

When you deploy from Streamlit Cloud, people assume that a cd mydir happens, because that’s what a lot of people do on local development. This would imply a run command of:

streamlit run streamlit_app.py

But what Streamlit Cloud always does is starts at the top-level, passing in the entire path that the user puts into the launch window. This implies a run command of:

streamlit run apps/myapp/v2/justkidding/v7/streamlit_app.py

So when people go from their local environment development to Streamlit Cloud, references like this will break:

with open('file.txt', 'r'):
   do_something()

While one could argue that Streamlit Cloud should be a “do what I mean” system, this is why we suggest that users make their path references using pathlib or similiar package, to programmatically determine where they are in the file tree so that the code is robust across any deployment platform.

Best,
Randy

1 Like

Thanks for the clarification, Randy. :+1:

Yeah, thats what i meant with “wrecked”, maybe not the right word for it :zipper_mouth_face:

I think most users don’t know this and are wondering, why their paths are not working anymore.

1 Like

how did you solve it? i did not get it. thanks!

Put your app.py(assuming it to be your main page of your app) at the root directory.

Thnaks for your answer. Do yo mean to put it at the root directory of github? How can i do that? (now it is inside a default branch called “main”)
thanks!

Hi Randy, i am still not getting your solution
can you give me some extra information?
do i have to put the file app.py at the root directory of my github? how can i do that?
best and thanks

Hi @pilarpique,
To put app.py at the root directory, you would simply put it in your repository without putting it in a folder.
Hope that helps clarify!
Caroline

thank you very much caroline! actually my app.py is not in a folder and config.toml is still not working. do you know why this is happening?

Hi @pilarpique, have you tried deleting and re-deploying the app?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.