Django web service: commits wipe db!

Hi, I have my backend django web service deployed, but I’ve noticed that new commits wipe the data!!!
I have a postgreSQL (hosted by render) for my db. I notice that in the dashboard for my webservice there is a section called Disks which seems to indicate that I need to setup something here to manage this situation, but I’m clueless as to what I’m supposed to do?!?
Can someone point me in the right direction here, do I need a db and a disk ? if so how does one setup this disk?

Hey there.

It depends on what exactly you mean by the data being wiped. Render services have an ephemeral filesystem, so changes to the filesystem are lost when a service redeploys or restarts. There’s some great guidance in the docs linked previously that may help you decide what you can use to persist your data as desired.

hi, thanks for responding. I guess what I mean is, I do a commit->deploy and then all of sudden I cannot log into the django admin app. I create a new superuser and login to find, that new superuser is the only user!

I have a postgreSQL database setup on Render, I am using it for this app. why do I need more persistence when I already have a postgreSQL database?

I may have figured out what the issue is … me! surprise :confused:

I think what was happening is that my django settings for checking debug mode were not up to scratch, and it was falling back to the sqlite db which I use locally for dev. and I’m guessing on Render this database was being setup and then lost after every commit->deploy. I’ve just ensured the code is good and now I think it’s using the postgreSQL db as it should be.

That makes sense. If it was falling back to that local database, it would be stored locally on disk. Once redeployed (or restarted), the service would lose any changes made to its filesystem.

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