Handling file paths for local versus cloud

What is the best way to handle file paths in the code for a deployed app when it will change depening on if running locally or cloud? Sometimes the path when deployed seems to change and when deployiing you get the ‘file does not exist’ error.

  • all file paths in streamlit cloud are relative to the root folder of the github repo
  • always run your local streamlit app from the root folder of the git repo, too
  • don’t use any local paths that are not in the git repo
  • don’t use absolute paths
  • don’t use windows paths
1 Like

Thank you! I wasn’t quite sure how streamlit handled paths during deployment.

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