r/FastAPI • u/Impressive-Hat1494 • Aug 21 '21
Question Shell for Fast api ?
There is shell in django , My teams wants the same for Fast api. I tried with IPython but the problem is I can't use Tortoise orm Queries as it says database has no connection and other stuff. My question : Is there any way to make or install a shell for fast api project.
2
u/wrtbwtrfasdf Aug 22 '21
Ipython will work just fine for running orm commands. All you need is a file that properly sets up the connection and models.
1
6
u/sasmariozeld Aug 21 '21
i honestly cannot come up with a common valid use case for a fastapi cli in the last 5 minutes
1
4
1
u/sanketp60 Oct 16 '22
Try using pdb.
Add following lines to your code (preferably in your main app after imports):
import pdb
pdb.set_trace()Hope that helps :)
1
Aug 22 '21
There's not a "shell" with fastapi because the philosophy of the framweork is different than Django's monolithic philosophy. Django provides its orm. Fastapi wants to be "agnostic". It is up to you to chose the orm and how to interact with it.
0
3
u/pytheous1988 Aug 22 '21
I guess my first question would be, what do you need the shell for? It's more likely you are trying to interact with the database in some way. The best thing to do would be to build out commands in click to your ORM layer or choice that does what you need it to do.