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:
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...
Jump to solution
8 Replies
Percy
Percy10mo ago
Project ID: f0d00a68-5db3-4665-bf82-a4919d539271
Percy
Percy10mo ago
Project ID: f0d00a68-5db3-4665-bf82-a4919d539271
Smack | DM FOR NODE RENT
f0d00a68-5db3-4665-bf82-a4919d539271
Solution
Brody
Brody10mo ago
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
Smack | DM FOR NODE RENT
Oh 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:
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'daphne'
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1140, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'daphne'
Brody
Brody10mo ago
the command is ran locally, thus you would need to have all the modules your app requires installed locally as well
Smack | DM FOR NODE RENT
Aah, I see. I'll try setting that up That worked great. Way easier than I expected. Thanks for the blazing fast support @Brody
Brody
Brody10mo ago
no problem!
Want results from more Discord servers?
Add your server