How to use Django ORM in FastAPI
dev.toΒ·7hΒ·
Discuss: DEV
Flag this post

Intro

Django was my go to framework for anything. I still Love Django framework. I thought, nicest thing was Django’s ORM. So, I try here to integrate Django ORM with FastAPI.

Content

I created a folder for project first.

mkdir django.orm.with.fastapi
cd django.orm.with.fastapi

Then I did a few django project specific bootstrapping here with following commands. That dot (ie. β€œ.”) at the end describe where the project is created. Rest you probably know or you can search and understand or ask LLM easily.

django-admin startproject config .
python manage.py startapp app1
# Now add app1 to INSTALLED_APPS
INSTALLED_APPS = [
...
"app1",
]
# end of settings.py file editing
python manage.py migrate


Now project folder is something like this. Kindly note…

Similar Posts

Loading similar posts...