Django dump data (backup)




    The dumpdata command exports the Django database in a plain text format, while the loaddata command imports the contents of that file into the current Django database.

    Library: django

    python dumpdata > db.json
    #to restore
    python loaddata db.json
    #in case of content integrity error
    python shell
    >>> from django.contrib.contenttypes.models import ContentType
    >>> ContentType.objects.all().delete()
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.