Skip to content

Instantly share code, notes, and snippets.

@jonahfang
jonahfang / gist:07f9a3cbeaac7e2ebafc3d1dec3ad0ac
Created November 23, 2022 18:53
Django syncdb command came back for v4.1.3 version.
from django.apps import apps
from django.conf import settings
from django.core.management.base import BaseCommand
from ._create_sql_of_model import get_create_sql_for_model
from ._helper import select_by_raw_sql,exec_by_raw_sql
def _run():
for app in settings.INSTALLED_APPS:
app_name = app.split('.')[0]
app_models = apps.get_app_config(app_name).get_models()