Closed zuxriddin99 closed 3 years ago
try this -- pip install --upgrade django-cors-headers pip install --upgrade djangorestframework pip install --upgrade drf_yasg
Post your pip freeze
please. I suspect you have some old package versions in there.
How explained by @ Brand0R in the SO https://stackoverflow.com/a/59252857/11281707.
The Django 3.0.0 release notes specify that certain private Python 2 compatibility APIs were removed. Among those was django.utils.six.
So I've got the same problem using Python 3.9.1 with Django==3.0.7
and django-cors-headers 3.3.0
from the requirementes.txt
.
Package Version
------------------- ---------
asgiref 3.3.1
certifi 2020.12.5
chardet 4.0.0
coreapi 2.3.1
coreschema 0.0.4
Django 3.0.7
django-cors-headers 3.3.0
django-sslserver 0.19
djangorestframework 3.9.1
fcm-django 0.3.4
idna 2.10
itypes 1.2.0
Jinja2 2.11.2
MarkupSafe 1.1.1
pip 20.3.3
pyfcm 1.4.7
pytz 2020.5
requests 2.25.1
setuptools 51.1.1
six 1.15.0
sqlparse 0.4.1
uritemplate 3.0.1
urllib3 1.26.2
To solve this problem I found two ways:
(I) downgrading Django to the last LTS version pip install Django==2.2
as sugested in SO.
(II) updating django-cors-headers pip install --upgrade django-cors-headers
as sugested by @aryan-jadon.
Okay I've update the requirements just to be sure, and my complete list is now this:
asgiref==3.2.7
certifi==2020.4.5.2
chardet==3.0.4
coreapi==2.3.1
coreschema==0.0.4
Django==3.0.7
django-cors-headers==3.6.0
django-sslserver==0.19
djangorestframework==3.12.2
fcm-django==0.3.4
idna==2.9
itypes==1.2.0
Jinja2==2.11.2
MarkupSafe==1.1.1
pyfcm==1.4.7
pytz==2020.1
requests==2.23.0
requests-toolbelt==0.9.1
sqlparse==0.3.1
uritemplate==3.0.1
urllib3==1.25.9
Server starts fine with these
Feel free to reopen if issue persists
I try to use python 3.9 3.8 3.6 but not working. All the time working this bug
ImportError: cannot import name 'six' from 'django.utils' (C:\Users\acer_\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\__init__.py)