2017-01-10 1 views
0

Django에서 데이터를 덤프하는 중 셸에 설치된 응용 프로그램을 검사하려고 할 때이 문제가 발생합니다.Django가 설치된 응용 프로그램을 찾지 못했습니다.

[[email protected] kb]$ python2.7 manage.py dumpdata > dump.json 
System check identified some issues: 

WARNINGS: 
?: (1_6.W001) Some project unittests may not execute as expected. 
    HINT: Django 1.6 introduced a new default test runner. It looks like this project was generated using Django 1.5 or earlier. You should ensure your tests are all running & behaving as expected. See https://docs.djangoproject.com/en/dev/releases/1.6/#new-test-runner for more information. 
CommandError: Unable to serialize database: cannot import name simplejson 
[[email protected] kb]$ python2.7 
Python 2.7.5 (default, Nov 6 2016, 00:28:07) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import simplejson 
>>> 
+2

[this] (http://stackoverflow.com/questions/28048943/cannot-import-name-simplejson-after-installing-simplejson) 문제가있는 것으로 보입니다. 앱이 장고의 이전 버전 용으로 제작 되었습니까? – yorodm

답변

2

장고는 django.utils.simplejson에, simplejson의 자체 버전을 제공하는 데 사용하지만, 파이썬의 표준 라이브러리는 이제 JSON 모듈을 가지고 있기 때문에 그 1.5 (거의 4 년 전)에서 제거되었다.

코드가 실행하려고하는 장고 버전과 100 % 호환되지 않는 것으로 보입니다.

+0

django 1.7로 사이트가 실행 중입니다. 이전에는 장고 1.2를 사용하고있었습니다. 이 경우 덤프 데이터를 가져 오는 가장 좋은 방법은 마이그레이션해야합니다. –

+0

이 오류의 경우 simplejson을 가져온 위치를 찾고 import json으로 simplejson 또는 so로 변경하십시오. 그러나 다섯 가지 버전으로 변경된 다른 것들이 _lot_ 있습니다. 어쩌면 장고 1.2를 설치하고 그걸로 덤프 데이터를 실행할 수 있을까요? – RemcoGerlich

+0

먼저 데이터베이스를 dev 컴퓨터로 복사하십시오. – RemcoGerlich

관련 문제