निराकरण: जॅंगो डंप मागील स्थलांतर

मुख्य समस्या अशी आहे की जर तुम्ही स्थलांतर टाकून पुन्हा स्थलांतर चालवण्याचा प्रयत्न केला, तर जॅंगो तुम्ही केलेले बदल ओळखणार नाही आणि त्याऐवजी मूळ स्थलांतर पुन्हा चालवेल.

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>

डंप म्हणजे काय

डेटाबेसमधील मजकूर फाईलमध्ये डंप करण्यासाठी डंप हे कमांड लाइन साधन आहे.

Django मध्ये स्थलांतर करण्यासाठी Wot

1.8

Django 1.8 मध्ये तुमचा डेटा स्थलांतरित करण्याचे काही वेगळे मार्ग आहेत.

1. तुमच्या डेव्हलपमेंट सर्व्हरवर स्थलांतरांची मालिका चालवण्यासाठी माइग्रेट कमांड वापरा:

$ python management.py स्थलांतर

2. जॅंगो-माइग्रेट टूल वापरा:

$pip स्थापित करा django-migrate $cd myproject $django-migrate init $python management.py स्थलांतर

संबंधित पोस्ट:

एक टिप्पणी द्या