开发者

(Python/Django): How do I keep my production db in sync (scheme and data) and with dev pc db?

I have a local Postgres databa开发者_高级运维se which will be filled with data (daily) on my local development machine. What is a good solution to transfer/sync/mirror this data to a production Postgres database.

For what it's worth I'm developing in Python using Django.

Thanks!


This seems like a strange workflow for me. Wouldn't it be much better to import the data in the production database and then just sync it with your development db from time to time? IMO, the development machine shouldn't be included in the production data workflow.

That's the way I do it using fabric. I've written a simple function which copies part of the production db onto the local development machine.


South is a great tool for dealing with database migrations in Django projects. The latest release now supports both schema and data migrations

http://south.aeracode.org/docs/tutorial/part3.html#data-migrations

The app provides a number of management commands which allow you to dump executable files which when run can alter the database schema or insert records. It's great for automating changes to a production environment or when working on a team. You could then use something like fabric (or do it manually if you must) to push up the migration files and run the migrate command to populate your database

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜