Config.toml location

Hi,
I feel stupid to ask this, but where do I find the config.toml file? I would like to change the port. I am running Streamlit on a Windows machine. Thanks for your help.

1 Like

Hey,

It’s at ~/.streamlit/config.toml by default the file doesn’t exist, you have to create it if you want to overrite default config.

(the default config is shown by command streamlit config show)

2 Likes

Hello,

In windows installation which is the folder that the toml file should be located?

Thank you.

1 Like

Hi again, I found the folder, its in user folder (C:\Users\xxxx\.streamlit)

2 Likes

Perfect! when created there, the settings is picked up. Thanks alot, I was searching in the wrong place.

1 Like

[Mac]
I need help understanding this: If the config.toml is not created by default in the ~/.streamlit location, where is the streamlit config show sourcing this info from? Also I can see that there is a file called credentials.toml file in ~/.streamlit folder but no config.toml by default.

If I have to create a config.toml file in the ~/.streamlit location do I have to copy+paste all the contents from the output of streamlit config show and then make mods to this newly created file?

I guess from this one?
https://github.com/streamlit/streamlit/blob/develop/lib/str…

1 Like

Hi @vshets,

where is the streamlit config show sourcing this info from?

It’s coming from the streamlit executable itself. All of the config options are dynamically created and set to their defaults in the code, so streamlit config show just prints them out for you.

do I have to copy+paste all the contents from the output of streamlit config show and then make mods to this newly created file?

You do, but there’s an easy way to do this on a Mac:

streamlit config show > ~/.streamlit/config.toml

Then just open ~/.streamlit/config.toml in any basic editor and edit the values you need in that file. E.g. you could do:

nano ~/.streamlit/config.toml

…to open it in the command-line-based text editor, nano.

I hope that helps!

4 Likes

hi! I have a Mac and have absolutely no idea where the mods.toml is! i have searched everything! can anyone help me?

Thanks in Advance

Can´t see the config.toml file in window

Look the structure of this project and you will understand, it helped me: GitHub - mesmith027/Theming_tutorial: App to demonstrate how to use Streamlit's new custom themes

You don’t have to put the config.toml file into the users home directory.
You can place the config.toml individually for each streamlit project into a subfolder in your project folder:

.streamlit/config.toml

And you have to insert only those entries in the config.toml file which differ from the default configuration.

2 Likes

@godot63 config.toml should be put under which folder your python program locates,
and config.toml’s function is set the port of python program will use.
for example, if your python program is under C root directory and you want use the port 9200
you can put the config.toml with content “[server]\nport=9200” and your python program under C disk root directory.
in this way, when you run “streamlit run yourpythongram” under C disk, your program will use 9200 port in the browser.

wow, tks. I wonder the format is fits for .toml ?

you can just use code like this to run your python project with a special port:
streamlit run yourpythonprojectname --server.port 9200
in this way, you can use different port to run different python projects