0

I have a main project, and some apps:

proj
├── proj
│   ├── admin.py
│   ├── forms.py
│   ├── __init__.py
│   ├── models.py
│   ├── settings.py
│   ├── urls.py
│   ├── views.py
│   └── wsgi.py
├── static
├── manage.py
├── app1
├── app2
└── app3

proj has some models, but makemigrations does not detect them. If I force it:

» python manage.py makemigrations proj
App 'proj' could not be found. Is it in INSTALLED_APPS?

Well, of course it is not installed: it is not an App: it is the main project! I have not invented this structure: django-admin startproject is the one setting it up.

How can I convince django to recognize the models in the main project?

blueFast
  • 41,341
  • 63
  • 198
  • 344

1 Answers1

1

The default Django project layout doesn't expect you to put migrations in proj/proj. If you want to do this, you need to add 'proj' to your INSTALLED_APPS.

A common approach is to create an app e.g. core and put models specific to your project there.

Alasdair
  • 298,606
  • 55
  • 578
  • 516