Django migrations in subfolders
<p>I have the following project structure:</p>

<pre><code>bm_app_1
 | contents here
bm_app_2
 | contents here
bm_common
 | __init__.py
 | deletable
 |  | __init__.py
 |  | behaviors.py
 |  | models.py
 | timestampable
 |  | __init__.py
 |  | behaviors.py
</code></pre>

<p>The files in app <code>bm_common</code> define managed models, that I want in migration files. When I run <code>python managepy makemigrations</code> however, the files inside the subfolders of the app <code>bm_common</code> are not taken into account. All apps are in <code>INSTALLED_APPS</code></p>

<pre><code>PREREQ_APPS = [
    required apps here
]
PROJECT_APPS = [
    'bm_common',
    'bm_app_1',
    'bm_app_2'
]
INSTALLED_APPS = PREREQ_APPS + PROJECT_APPS
</code></pre>

<p>Is there a way to change the behavior of <code>makemigrations</code> to look into subfolders as well? If not, what would be a good suggestion to make this split? I do not want to have all behaviors in one <code>behaviors.py</code>, because it grows too big and was causing circular references for me.</p>

<p>The models need to be imported in some way when the app registry is populating all models, otherwise they are not registered and Django doesn't know about them. The easiest solution is to create a <code>bm_common/models.py</code> file and import all models in there:</p>

<pre><code>from .deletable.models import ModelA, ModelB
from .timestampable.models import ModelC
...
</code></pre>

python django django-models django-migrations