Deployement error when main.py file is not in main folder

Hi,
I am trying to deploy my app on streamlit community cloud. I am having trouble understanding how to do it correctly.
My github repository is :


in .streamlit my config.toml has the following:

[theme]
font="monospace"

[server]
maxUploadSize=20
headless = true
enableCORS = false

[browser]
serverAddress = "py_code/main.py"

All my code is in py_code folder, with the main file is main.py. In py_code I have my init.py where I declared all the functions I am using.
my code structure is as follows:


when deploying the app on streamlit, i had to set it up as follows:

the Main file path i declared py_code/main.py .
However, when I deploy, I have errors that the module py_code does not exist.
Can anyone steer me in the right direction on how to deploy correctly? Do I need to change my code folder structure?
Many thanks for the help.
GR.

Hi @abalgir

I’ve tried deploying an app where the streamlit_app.py is residing in a sub-folder (please see below screenshot) in a similar way and it worked. However, my .streamlit/config.toml file is left as default set by app-starter-kit. Perhaps you could try again by tweaking the config file, it seems that the serverAddress parameter is not needed for deployment.

Hope this helps!

Many thanks for the sample and explanation. i will test it this afternoon.

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