On 24/04/2018 8:57 AM, Anthony Flury wrote:
> You can use manage.py dumpdata and manage.py loaddata
>
> And you can do this per app - or even per table.
Thank you Anthony
I had totally forgotten that. In fact I actually script dumpdata for
dumping test data (ie fixtures) but loaddata never worked for me. So
much so that I was easily able to expunge it from my overloaded
brainspace :)
Cheers
Mike
>
> The challenge is if your production server already has data in it, and
> uses Auto Incrementing Ids, then the ids from the development wont be
> valid in the production server.
>
> You also have the challenge that your data-base might not allow you to
> Insert values into a field which is meant to be based on an
> incrementing sequence.
>
> --
> Tony
>
> On 23/04/18 23:41, Mike Dewhirst wrote:
>> On 24/04/2018 5:50 AM, Tom Tanner wrote:
>>> Hey all, I have a bunch of tables on my local Django project. I set
>>> up the project on my production server and ran `manage.py migrate`.
>>> That set up the tables, but now I want to move the rows from my
>>> local tables to the ones on the production server. Both local and
>>> production server use Postgres. Is there a Django way to move the
>>> table data to production?
>>
>> Not unless someone has written one and made it available. I haven't
>> googled that so I don't know.
>>
>> My approach would be to dump and reload if you want identical
>> databases in dev and prd. You are looking for pgdump to make a dump
>> file and to load at the other end you probably want dropdb, createdb
>> and psql.
>>
>> It is worthwhile writing a couple of scripts to manage that.
>>
>> Mike
>>
>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Django users" group.
>>> To unsubscribe from this group and stop receiving emails from it,
>>> send an email to django-users+unsubscribe@googlegroups.com
>>> <mailto:django-users+unsubscribe@googlegroups.com>.
>>> To post to this group, send email to django-users@googlegroups.com
>>> <mailto:django-users@googlegroups.com>.
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/f65cd8eb-6399-4ee7-8830-84b19ea9b689%40googlegroups.com
>>> <https://groups.google.com/d/msgid/django-users/f65cd8eb-6399-4ee7-8830-84b19ea9b689%40googlegroups.com?utm_medium=email&utm_source=footer>.
>>>
>>> For more options, visit https://groups.google.com/d/optout.
>>
>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/13aef0e9-04bd-527b-47ef-d783789b7a11%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment