2017-01-10 36 views
0

嘗試從django轉儲數據以獲取此問題,當我嘗試檢查應用程序(已安裝)時,它出現在shell中。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

似乎你有[這個](http://stackoverflow.com/questions/28048943/cannot-import-name-simplejson-after-installing-simplejson)的問題。該應用是否爲較早版本的Django創建? – yorodm

回答

2

Django的用於裝運自己的simplejson的版本,在django.utils.simplejson,但在1.5(將近四年前)移除,因爲Python的標準庫現在有一個json模塊。

看起來你的代碼與你試圖運行的Django版本不是100%兼容的。

+0

該網站是與Django 1.7運行我認爲它曾經有Django 1.2之前。在這種情況下,我將如何最好地獲得dumpdata,需要遷移。 –

+0

對於這個錯誤,找到simplejson導入的位置,並將其更改爲import json,類似simplejson;但有五種版本的其他內容已經發生變化。也許安裝一個Django 1.2並運行dumpdata? – RemcoGerlich

+0

首先將數據庫複製到開發計算機。 – RemcoGerlich

相關問題