$ python manage.py loaddata fixtures/initial_data.yaml
Problem installing fixture 'fixtures/initial_data': yaml is not a known serialization format.
$
$ python manage.py loaddata fixtures/initial_data.yml
Problem installing fixture 'fixtures/initial_data': yml is not a known serialization format.
根据Django文档,应该支持这种格式,但是我得到了上述错误。另一方面,JSON工作正常。
Django版本:
django.VERSION (1,3,1,'final',0)
答案 0 :(得分:31)
.yaml就是你想要的。通过运行:
确保安装YAML并可供Python使用> pip install pyyaml
答案 1 :(得分:0)
sudo apt-get install python-yaml
apt-get install python-yaml