Python3 application which exports Django models to json or yaml file format.
Use this module on your own risk because of non-stable version.
$ pip install djexp- Django>=2.1.5
I am not sure if it works with earlier Django versions.
- PyYAML==3.13
$ djexp -r ./ -s ProjectName.settings --jsonExample structure:
ProjectName/
...
manage.py
core/
__init__.py
...
models.py
management/
__init__.py
commands/
__init__.py
export_models.py
views.py
...
...
Implement command, export_models.py:
from ProjectName.settings import BASE_DIR
from djexp.task import export_django_models
from django.core.management.base import BaseCommand
class Command(BaseCommand):
def handle(self, **options):
export_django_models(
root=BASE_DIR,
settings_module='ProjectName.settings',
file_format='yml'
)Run created management command:
$ python manage.py export_modelsThe project is licensed under the terms of the GNU General Public License v3.0, see the LICENSE file for more information.