Django | python manage.py flush
Hey,
I have a django rest api that is set up and running. I'm in the need of flushing the database (preferably without removing any tables or migrations).
- Database: Postgres
- Backend: Django
Normally I would just run
python manage.py flush
, how can I run this command on a hosted service? Is there a way to SSH or access the terminal of the service?
Thanks!Solution:Jump to solution
installed the railway cli, link your project to your desired service, then run
railway run python manage.py flush
this runs the command locally, but with the service variables now also available locally
https://docs.railway.app/guides/cli...8 Replies
Project ID:
f0d00a68-5db3-4665-bf82-a4919d539271
Project ID:
f0d00a68-5db3-4665-bf82-a4919d539271
f0d00a68-5db3-4665-bf82-a4919d539271
Solution
installed the railway cli, link your project to your desired service, then run
railway run python manage.py flush
this runs the command locally, but with the service variables now also available locally
https://docs.railway.app/guides/cliOh cool. I'll try that and get back to you
Ok, I tried it. I get some error that it is unable to find my module "daphne".
I also tried the same command over on my dockerized environment running locally, and the command works immediately (I ran this directly via the terminal window of the container inside the Docker App)
Error:
the command is ran locally, thus you would need to have all the modules your app requires installed locally as well
Aah, I see. I'll try setting that up
That worked great. Way easier than I expected. Thanks for the blazing fast support @Brody
no problem!