Kuxazululiwe: i-django lahla ukufuduka kwangaphambilini

Inkinga enkulu ukuthi uma ulahla ukuthutha bese uzama ukuqalisa ukuthutha futhi, i-django ngeke ibone izinguquko ozenzile futhi esikhundleni salokho izophinda iqalise ukuthutha kwasekuqaleni.

I am trying to dump my previous migrations in Django. I have tried the following command:
<code>python manage.py dumpdata --exclude contenttypes --exclude auth.permission &gt; app/fixtures/initial_data.json</code>
However, this only dumps my current data and not the data from my previous migrations. How can I do this?


A:

You can use <code>--format=json</code> to export your data into a json file and then you can use it as a fixture for your future migrations: 
<code>python manage.py dumpdata --format=json --indent=4 &gt; app/fixtures/initial_data.json  # add all your apps here separated by spaces 
</code>

Kuyini ukulahla

I-Dump iyithuluzi lomugqa womyalo wokulahla okuqukethwe kwesizindalwazi kufayela lombhalo.

Wot ukuthuthela e-Django

1.8

Kunezindlela ezimbalwa ezihlukile zokuthutha idatha yakho ku-Django 1.8.

1. Sebenzisa umyalo wokuthutha ukuze usebenzise uchungechunge lokufuduka kuseva yakho yokuthuthukisa:

$ python manage.py migrate

2. Sebenzisa ithuluzi le-django-migrate:

$ pip faka i-django-migrate $ cd myproject $ django-migrate init $ python manage.py migrate

Okuthunyelwe okuhlobene:

Shiya amazwana