I want to execute fastapi in shell.
for example, we can do it with below code in django:
python manage.py shell
how can I do this in fastapi?
I want to execute fastapi in shell.
for example, we can do it with below code in django:
python manage.py shell
how can I do this in fastapi?
Simple answer, You can not.
manage.py does the same thing as django-admin but also sets the DJANGO_SETTINGS_MODULE environment variable so that it points to your project’s settings.py file. In FastAPI we don't have admin utility, because there is no out-of-box config, environment management etc. That's the main difference between a microframework and a high-level framework.
FastAPI does not have any administration utilities out-of-box.
In terminal go to directory where your main.py is and type
uvicorn main:app --host 0.0.0.0 --port 8888