Django loads models by importing the models module of each package in the INSTALLED_APPS setting. For example, with the setting INSTALLED_APPS ('django.contrib.admin', 'django.contrib.comments', 'spam.ham', and 'eggs') , Django imports models from django.contrib.admin.models , django.contrib.comments.models , spam.ham.models and eggs.models .
If you specify only your external application in INSTALLED_APPS (suppose it is called eggs ), then only models from eggs.models are imported and created. To get the models installed from your internal application, you also need to add it to INSTALLED_APPS , for example, eggs.inner_app so that eggs.inner_app.models imported. (To facilitate foreign keys, I am sure that if you import models from one application into another models.py file, only the models defined in the scanned models.py file are models.py .)
Leafstorm
source share