I'm trying to layout my Django app, and I just cannot figure out what the appropriate way to do it is. I've read many questions and blog posts, but nothing seems obvious.
Here's my app (I hate the repetition of these terms like buildhealth
, but I guess it's idomatic in Django?) - the name of the project, created by django-admin startproject buildhealth
and the name of the first app (a performance dashboard) created by django-admin startapp performance
is performance
):
[ROOT]
├── ...
├── buildhealth
│ ├── __init__.py
│ ├── buildhealth
│ │ ├── __init__.py
│ │ ├── asgi.py
│ │ ├── performance
│ │ │ ├── __init__.py
│ │ │ ├── ...
│ │ │ ├── views.py
│ │ │ └── ...
│ │ ├── settings.py
│ │ ├── urls.py
│ │ └── wsgi.py
│ ├── ...
│ ├── manage.py
│ └── staticfiles
│ └── ...
├── poetry.lock
├── pyproject.toml
└── ...
This sort of works, but then i have files all over the place for doing imports which feels terrible. For example - in settings.py
, i have to type this:
ROOT_URLCONF = "buildhealth.buildhealth.urls"
This feels super wrong to have two imports like this. Am I laying this out wrong? Am I not importing things correctly? I can't believe that's how it's SUPPOSED to be.