Install deps:
poetry config virtualenvs.in-project true
poetry install
To activate the virtualenv
poetry shell
Otherwise you can just append any command with poetry run
. For example: poetry run python main.py
Django Ninja specific stuff:
# create a new project
django-admin startproject [proj_name]
# create an application
python manage.py startapp [app_name]
At this point you should define your models
### [app_name]/models.py
from django.db import models
class SomeClass(models.Model):
...
Then
- register then for display in the admin panel as well
- add the app to
[app_name]/settings.py
inINSTALLED_APPS
- run migrations
python manage.py makemigrations # creates a SQLITE db
python manage.py migrate # creates the tables in the db
# create a superuser
python manage.py createsuperuser
Finally start the dev server
python manage.py runserver