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:

是否有一种方法可以只在创建合适的表时执行Django fixture ?我有一些最初的数据应该放在应用程序表中,但是一旦表出现了,我不想要每一个。/管理。py syncdb刷新数据。根据Django文档,这似乎只能用SQL格式来完成,而不是JSON / YAML:

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

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

1 个解决方案

#1


1

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.

您将希望使用post_syncdb信号,并在创建特定应用程序或模型时通过底层方法过滤/手动加载fixture。

更多相关文章

  1. 检查 NaN 数据值 (C/C++/Python 实现)
  2. 在两台服务器上有效地在两个Django应用程序之间进行通信(多租户)
  3. 【python网络爬虫三】爬取动态数据及数据入库
  4. 如何停止Py_Initialise应用程序的崩溃?
  5. 数据挖掘(三)分类模型的描述与性能评估,以决策树为例
  6. 用于Python项目的低内存和最快查询数据库
  7. python爬虫:爬取豌豆荚APP第一页数据信息(selenium)
  8. Pandas 文本数据方法 findall( )
  9. TensorFlow数据集(一)——数据集的基本使用方法

随机推荐

  1. linux下编译Hive 源码并导入eclipse中(使
  2. linux下查找包含关键字的文件
  3. Linux(Debian)设置开机自启动脚本
  4. jira 4.2破解安装Linux和windows版
  5. ubuntu 16.04 设置选项里面找不到《打印
  6. 使用VNC完成远程调用图形化
  7. 手动制作mini linux详细步骤―之二
  8. [Linux] 总结各系统 双网卡绑定
  9. 请问同一软件为什么linux版的要比xp版的
  10. busybox1.19.3编译错误解决办法