[Answer]-Get SQL schema for django models

1👍

Even if you split models into multiple files, you still need to create a ‘models’ package in your app, the project structure could be,

--app
----models
------__init__.py

in init.py,you need to import the model classes and set them into globals, you can do it manually or dynamically, e.g.,

from auth_* import XXXModel
current_global = globals()
current_global[XXXModel.__name__] = XXXModel

then, python manage.py sql can find the model schemas.

Leave a comment