I am using python manage.py shell in my flask application to use IPython shell for accessing my applicaton from shell. Is there any equivalent for this in fastApi?
I am using python manage.py shell in my flask application to use IPython shell for accessing my applicaton from shell. Is there any equivalent for this in fastApi?
If you want to interact with orm models directly, you can run main.py in interactive mode and import all your models there.
To enter interactive mode, run
python3 -i app/app/main.py
-i flag allows you to
enter interactive mode after executing the script or the command
After entering the interactive shell, you can import all the models using
from app.models import *
Note that your models structure might be different so you have to change the above import accordingly. In my case all the models was imported in __init__.py file, that's why I could import all of them in one go.