Generate pages from a config file

I want to create pages by reading options from a config file

Reading the documentation I understand that in order to create a multi page app I have to add all my pages under a /pages folder which will be read from the main page. In the app I am trying to build I don’t know the pages beforehand and I need to read some options from a config file in order to know the name and the number of pages I should create.

The way I do it now is by reading the config file and creating the .py on the spot using Pathlib,

for page in conf['pages]:
   Path(f'pages/{page}.py').touch()

I was wondering if there is a better way to do this?

You might try out GitHub - blackary/st_pages: An experimental version of Streamlit Multi-Page Apps, which has the ability to generate the list of pages based on a toml config file or a list of files in the app code.

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