Suppose you have app named weather and a model in that app called City
- Create folder fixtures in weather directory
- run following comand form project main directory:
python manage.py dumpdata weather.City > "weather\fixtures\initial_data.json"
- Whats all
python manage.py syncdbyou data will be loaded to you app model
Lean more about initial data on django official page
No comments:
Post a Comment