ImportError: cannot import name 'JSONField'
ImportError: cannot import name 'JSONField'
我遇到错误:
File "/home/mark/Nova/nova/lib/fields.py", line 1, in <module>
from django.contrib.postgres.fields import JSONField
ImportError: cannot import name 'JSONField'
当我运行python manage.py runserver 0.0.0.0:8888
。尽管我已经安装了 simplejson
。
pip freeze
显示,
alabaster==0.7.12
Babel==2.7.0
bcdoc==0.16.0
boto3==0.0.21
botocore==1.0.0b3
certifi==2019.9.11
chardet==3.0.4
defusedxml==0.6.0
Django==1.8.2
django-bulk-update==1.1.4
django-cors-headers==2.0.2
django-facebook==6.0.3
django-pgjsonb==0.0.15
django-redis==4.2.0
django-revproxy==0.9.7
djangorestframework==3.1.3
djangorestframework-httpsignature==1.0.0
docutils==0.15.2
elasticsearch==1.6.0
facebook-sdk==1.0.0
filemagic==1.6
futures==2.2.0
geopy==1.11.0
google-api-python-client==1.5.0
httplib2==0.14.0
httpsig==1.3.0
idna==2.8
Jinja2==2.10.3
jmespath==0.7.1
MarkupSafe==1.1.1
mock==1.0.1
mongoengine==0.10.0
msgpack-python==0.5.6
nose==1.3.7
oauth2client==2.2.0
oauthlib==3.1.0
Pillow==2.8.2
psycopg2==2.8.4
py2neo==2.0.8
pyasn1==0.4.7
pyasn1-modules==0.2.7
pycryptodome==3.9.0
Pygments==2.4.2
PyJWT==1.7.1
pymongo==3.0.3
PySocks==1.7.1
python-dateutil==2.8.0
python-social-auth==0.2.10
python3-memcached==1.51
python3-openid==3.1.0
python3-pika==0.9.14
pytz==2019.3
redis==2.10.3
requests==2.2.1
requests-oauthlib==1.2.0
rsa==4.0
simplejson==3.7.3
six==1.12.0
snowballstemmer==2.0.0
Sphinx==1.3.1
sphinx-rtd-theme==0.1.9
sphinxcontrib-httpdomain==1.3.1
treelib==1.3.0
twilio==5.6.0
Unidecode==1.1.1
uritemplate==0.6
urllib3==1.10.1
解决这个问题的方法是什么?
JSONField
was added in Django 1.9 并且您使用的是 Django 1.8.2
我遇到错误:
File "/home/mark/Nova/nova/lib/fields.py", line 1, in <module>
from django.contrib.postgres.fields import JSONField
ImportError: cannot import name 'JSONField'
当我运行python manage.py runserver 0.0.0.0:8888
。尽管我已经安装了 simplejson
。
pip freeze
显示,
alabaster==0.7.12
Babel==2.7.0
bcdoc==0.16.0
boto3==0.0.21
botocore==1.0.0b3
certifi==2019.9.11
chardet==3.0.4
defusedxml==0.6.0
Django==1.8.2
django-bulk-update==1.1.4
django-cors-headers==2.0.2
django-facebook==6.0.3
django-pgjsonb==0.0.15
django-redis==4.2.0
django-revproxy==0.9.7
djangorestframework==3.1.3
djangorestframework-httpsignature==1.0.0
docutils==0.15.2
elasticsearch==1.6.0
facebook-sdk==1.0.0
filemagic==1.6
futures==2.2.0
geopy==1.11.0
google-api-python-client==1.5.0
httplib2==0.14.0
httpsig==1.3.0
idna==2.8
Jinja2==2.10.3
jmespath==0.7.1
MarkupSafe==1.1.1
mock==1.0.1
mongoengine==0.10.0
msgpack-python==0.5.6
nose==1.3.7
oauth2client==2.2.0
oauthlib==3.1.0
Pillow==2.8.2
psycopg2==2.8.4
py2neo==2.0.8
pyasn1==0.4.7
pyasn1-modules==0.2.7
pycryptodome==3.9.0
Pygments==2.4.2
PyJWT==1.7.1
pymongo==3.0.3
PySocks==1.7.1
python-dateutil==2.8.0
python-social-auth==0.2.10
python3-memcached==1.51
python3-openid==3.1.0
python3-pika==0.9.14
pytz==2019.3
redis==2.10.3
requests==2.2.1
requests-oauthlib==1.2.0
rsa==4.0
simplejson==3.7.3
six==1.12.0
snowballstemmer==2.0.0
Sphinx==1.3.1
sphinx-rtd-theme==0.1.9
sphinxcontrib-httpdomain==1.3.1
treelib==1.3.0
twilio==5.6.0
Unidecode==1.1.1
uritemplate==0.6
urllib3==1.10.1
解决这个问题的方法是什么?
JSONField
was added in Django 1.9 并且您使用的是 Django 1.8.2