Managing database between Render and Github


I am fairly new to the web game so I’m not sure what is the best way to go about this.

My website allows people to register and add items. These are stored in an SQLite database. However, the database is updated once daily from a local machine and backed up to Github immediately after. This overwrites whatever is stored. From a bit of searching it seemed that mounting a disk would resolve the issue. I did that and it still did not work so I must have done it incorrectly.

I mounted the disk to /project/src/instance. /project/src/ is where my app files are located and instance is where the database is.


You’re right in that mounting a disk is part of the solution - you also need to ensure that the database is written to that path as well - so that will depend on your language/framework of choice here.

You can use the shell tab in the dashboard to navigate the file system to see where that might be - ideally you want the DB in it’s own folder so then you can mount the disk to the absolute path. (using pwd is your friend here)

Also, don’t forget the the disk mount path is absolute, so /project/src is at the very top of the file structure, if you want the disk mounted to a path inside your code path, it would be under /opt/render/project/src/instance

John B
Render Support, UTC :uk:

Hi John,

Thank you for your response!

I took your suggestion and modified the path. However, I ran into an error of render not being able to find the database at build time.

“Dec 1 01:18:03 PM File “/opt/render/project/src/.venv/lib/python3.10/site-packages/sqlalchemy/engine/”, line 637, in connect
Dec 1 01:18:03 PM return dialect.connect(*cargs, **cparams)
Dec 1 01:18:03 PM File “/opt/render/project/src/.venv/lib/python3.10/site-packages/sqlalchemy/engine/”, line 615, in connect
Dec 1 01:18:03 PM return self.loaded_dbapi.connect(*cargs, **cparams)
Dec 1 01:18:03 PM sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file
Dec 1 01:18:03 PM (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)”


Hey John,

Please help me to resolve my problem also.

I messed around with it some more and got it to work. It was working initially but there was a “bug” in my program. This made it seem as though the program was not working. However, it was not a desirable result as I initially thought. I have decided to move over to PostgreSQL now.

Disks are only attached at runtime, so you’ll need to use the version in the repo there and then when the disk is mounted then the persistent version would be - of course, all of this is negated if you were to use Postgres.

John B
Render Support, UTC :uk:

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