[Fixed]-Model in sub-directory via app_label?

22👍

See Django ticket #10985: Explain how models can be organised in a directory

It may be that you aren’t importing your models into __init__.py?

3👍

syncdb will not create tables for models not located in <appname>.models, so import it in there, e.g. from apps.foo.models import SomeModel.

1👍

Here is a solution if you have a newer version of Django, supposing you have a subfolder named subfolder :

in apps.py of your folder app:

from django.apps import AppConfig

class MyappConfig(AppConfig):
    name = 'myapp'

    def ready(self):
        from myapp.subfolder import models

Leave a comment