How to completely dump the data for Django-CMS

后端 未结 4 1453
独厮守ぢ
独厮守ぢ 2021-01-30 23:49

I have an instance of Django-CMS already running in a production environment. I would like to dump all the data related to the CMS (PAGES and PLUGINS) so that I may load it bac

4条回答
  •  遇见更好的自我
    2021-01-31 00:21

    Here's an update to the procedure I use:

    ./manage.py dumpdata >fixtures/all.json
    
    psql
    DROP DATABASE [DBNAME];
    createdb -T template_postgis [DBNAME]
    
    ./manage.py syncdb
    
    psql [DBNAME]
    
    delete from auth_group_permissions; delete from auth_permission; delete from django_admin_log; delete from django_content_type;
    

    If you don't delete the tables above you'll get this error when loading the fixtures:

    IntegrityError: duplicate key value violates unique constraint django_content_type_app_label_key
    

    And then:

    ./manage.py loaddata fixtures/all.json
    

    Philipp

提交回复
热议问题