문제

JSON 비품을 만들어 MYAPP/Fixtures/에 넣었습니다. settings.fixture_dirs에 myApp/fixtures를 추가했습니다. 다음은 고정물을로드하려는 시도의 출력입니다.

jeff@jeff-linux:~/myapp$ ./manage.py loaddata --verbosity=2 default.json
Loading 'default' fixtures...
[...truncated checking default paths and installed apps/fixtures...]
Checking '/home/jeff/myapp/fixtures/' for fixtures...
Trying '/home/jeff/myapp/fixtures/' for default.json fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Trying '/home/jeff/myapp/fixtures/' for default.json.gz fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Trying '/home/jeff/myapp/fixtures/' for default.json.zip fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Trying '/home/jeff/myapp/fixtures/' for default.json.bz2 fixture 'default'...
No json fixture 'default' in '/home/jeff/myapp/fixtures/'.
Checking absolute path for fixtures...
Trying absolute path for default.json fixture 'default'...
No json fixture 'default' in absolute path.
Trying absolute path for default.json.gz fixture 'default'...
No json fixture 'default' in absolute path.
Trying absolute path for default.json.zip fixture 'default'...
No json fixture 'default' in absolute path.
Trying absolute path for default.json.bz2 fixture 'default'...
No json fixture 'default' in absolute path.
No fixtures found.
jeff@jeff-linux:~/myapp$ ls fixtures/
defaults.json  moneytrail.json

다음은 Default.json의 내용입니다 : [{ "pk": 1, "model": "myapp.feature", "fields": { "default_feature": "0.25"}}

여기서 명백한 것을 놓치고 있습니까? Fixture_dirs를 고정구 및 비품/ 동일한 결과로 시도했습니다.

감사.

도움이 되었습니까?

해결책

파일 : defaults.json

귀하의 명령 줄 인수 : default.json

잘 봐봐.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top