Django dump data (backup)

    0

    2

    Neuron123

    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 manage.py dumpdata > db.json
    
    #to restore
    python manage.py loaddata db.json
    
    #in case of content integrity error
    python manage.py 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.