Placing Django Models In Separate Files
The first thing I do when starting a Django project is to delete the standard views.py file and replace it with a directory. It won’t take you long before you’ve written enough views that a single file becomes huge. The same is true of models.py. If you have ten or more models then the file can quickly become a thousand line behemoth. I’d tried to split the file into a directory before, but it never worked, and the error messages were never helpful.
The solution is simple, you add a Meta class to your model with an app_label parameter.
from django.db import models class Test(models.Model): class Meta: app_label = 'myapp'
So, thanks Chris!