4👍
✅
For this you can use fixtures.
For example:
python manage.py dumpdata auth > fixtures/auth.json
This will store all models of package ‘auth’ (Users, Groups Relations) into auth.json
After Deployment you can use the following command to load:
python manage.py loaddata auth fixtures/auth.json
This will restore your prev state of ‘auth’.
Maybe it’s good for you to switch to South, a very famous part of Django to migrate databases instead of recreating them.
0👍
You can provide fixtures with the initial required data and it will be automatically inserted when you syncdb
. See docs
- [Django]-In Django Admin, I want to change how foreign keys are displayed in a Many-Many Relationship admin widget
- [Django]-Celery not working in django and just waiting (pending)
- [Django]-Humanizing django-tables2 output?
- [Django]-Deleted Django Migrations Folder
- [Django]-Sorl-thumbnail: resize original image before saving?
Source:stackexchange.com