开发者

Execute Django fixtures on table creation

Is there a way to execute a Django fixture just once - when the appropriate table is created? I have some initial data that should be put in the app tables, but once the tables are there, I don't want every ./manage.py syncdb to refresh the data开发者_开发技巧. According to Django docs it seems this can only be done for fixtures in SQL format and not JSON / YAML:

http://docs.djangoproject.com/en/1.3/howto/initial-data/


You're going to want to use the post_syncdb signal, and filter/manually load the fixture via the underlying methods when specific apps or models are created.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜