【问题标题】:How to dumpdata from django-tenant-schemas?如何从 django-tenant-schemas 中转储数据?
【发布时间】:2017-04-22 10:42:43
【问题描述】:

我正在尝试在我的应用程序模型上使用 manage.py dumpdata,但我无法在我的转储文件中看到 json 数据,因为我正在使用 django-tenant-schemas 应用程序来管理各种客户端的模型。有没有解决特定模式相关的dumpdata的方法?

【问题讨论】:

    标签: python django django-models dumpdata


    【解决方案1】:

    我找到了解决办法:-

    python manage.py tenant_command dumpdata --schema="schema-name" app_name.model_name --indent 4 > fixtures/dump.json
    

    或者你可以使用:-

    for t in $(./manage.py list_tenants | cut -f1);
    do
        ./manage.py tenant_command dumpdata --schema=$t --indent=2 auth.user > ${t}_users.json;
    done
    

    我在这里找到了答案:-

    http://django-tenant-schemas.readthedocs.io/en/latest/use.html?highlight=dumpdata

    【讨论】:

      猜你喜欢
      • 2018-04-11
      • 2016-05-10
      • 1970-01-01
      • 2020-08-01
      • 1970-01-01
      • 2020-03-13
      • 2015-10-11
      • 2023-03-29
      • 2011-12-07
      相关资源
      最近更新 更多