Closed jtimberman closed 12 years ago
You can actual have initial data upon table creation; these are call fixtures.
https://docs.djangoproject.com/en/dev/howto/initial-data/
You can dump apps specifically and follow the format to create defaults for your project. So, I imagine from the way you are describing your issue you would want something along the lines of:
python manage.py dumpdata > fixtures/initial_data.json
Then probably something along the lines of:
python mange.py syncdb --noinput
or:
python manage.py loaddata fixtures/intiial_data.json
Ah, yup. Got working with fixtures/initial_data.json. Cheers!
Fwiw, in case someone else finds this, here's the JSON:
[{
"model": "auth.user",
"pk": 1,
"fields": {
"username": "allthepastes",
"first_name": "All",
"last_name": "The Pastes",
"is_active": true,
"is_superuser": true,
"is_staff": true,
"last_login": "2012-04-20 05:40:01",
"groups": [],
"user_permissions": [],
"password": "sha1$00000$HAAAAAAAAAAAAAAAASHED",
"email": "allthepastes@example.com",
"date_joined": "2012-04-20 05:40:01"
}
}]
It would be nice to do manage.py syncdb w/ some default options or options from settings.py without having to enter the prompts. It can be "scripted" with echo, but that smells funny :).