Mount Path Disk - Python app

Hi everybody,

I have a basic webapp designed with Streamlit in Python. Streamlit is extremely easy to deploy with just a single line of code:
streamlit run my_app.py

As I added a sqlite3 database to store some data form the webapp, I wanted to add Disk space to my webapp, so that the data are not getting lost each time a new version of my webapp is being deployed.

Issue:

After many hours spent in trying to understand how to setup the mount path of the Disk, I wasn’t able to set it up.
I have noticed that the folder coming from the github is being stored in opt/render/project/src, so tried to point to the same path, but it didn’t work.
In addition; I tried to set the mount path to /opt/var/app_name, but again without success.

Therefore, WHAT SHOULD BE THE MOUNT PATH OF DISK?

Thanks in advance!

Hey Opreka.

I just tested this by attaching a disk to /opt/var/app_name and it seemed to work.

After the service deploys:

$ echo "Hello World" > /opt/var/app_name/hello.out
$ cat /opt/var/app_name/hello.out 
Hello World

After deploying again:

$ cat /opt/var/app_name/hello.out 
Hello World

To clarify: When you add a disk, only files within that directory will persist across deploys. Files in /opt/render/project will be overwritten during the build, so a disk shouldn’t be used for that directory. Could you share the steps to reproduce the issue?

Thanks again Jake for this great answer. I was wondering, how in Python 3 Flask app
1- I could put my “uploads folder” on the Render mounted disk and
2- Then serve some files that I then upload to this uploads folder so other users can download them

When I run the flask app locally I can upload the files to the uploads folder and also successfully download them. However when I deploy the flask app on Render , only the old place holder files I left in the uploads folder can be seen and can be downloaded. Any new files I upload on the deployed flask app are not showing up in the uploads folder. My relative path names are the same on local machine and on Render.

Any assistance or pointing me to the parts in the documentation that covers this for Flask apps would be greatly appreciated since I seem to be doing something wrong.

Thanks again in advance.

We’ve chatted with @titus directly here via a Support ticket and have resolved the issue - it was a pathing issue with the mount path.