2016-04-23 44 views
0

Iam在加載django中的夾具時遇到問題。與無法加載夾具

./manage.py loaddata website/fixtures/webste 

加載時

./manage.py dumpdata --format=json >website/fixtures/webste 

現在我得到的錯誤:我創建了一個夾具與

python2.7/site-packages/django/core/management/commands/loaddata.py:225: UserWarning: No fixture named 'webste' found. 
    warnings.warn("No fixture named '%s' found." % fixture_name) 

雖然如果我進入

nano website/fixtures/webste 

它打開正確的文件。任何想法這裏有什麼不對?

回答

1

我認爲,所有你需要的是

./manage.py loaddata webste 

假設網站是在你的Django項目的安裝的應用程序。

[1] LoadData documentation

1

好吧,我想通了自己:該文件需要包含告訴Django序列化格式的擴展。所以我將這個文件重命名爲「webste.json」,然後上面的命令可以正常工作。