Hi there,
I just downloaded the code from github and i keep getting the following error : cannot import name 'six' from 'django.utils'.
Please help me resolve the issue. Thanks
Hey! That's removed in Django 3.0. django-cors-headers supports Django up until 2.1 right now. So, try to use six library instead of
django.utils.six
If you are using Django3,
pip install six
add six to the settings.py INSTALLED_APPS and migrate.
six
settings.py
INSTALLED_APPS
from django.contrib.auth.tokens import PasswordResetTokenGenerator from six import text_type class AccountActivationTokenGenerator(PasswordResetTokenGenerator): def _make_hash_value(self, user, timestamp): return ( text_type(user.pk) + text_type(timestamp) + text_type(user.profile.signup_confirmation) ) account_activation_token = AccountActivationTokenGenerator()
Worked great, adding to setting.py, huge thanks
hey this doesn't work for me... you say add six to settings.py, do you mean like this ?
INSTALLED_APPS = [ ... 'django.contrib.staticfiles', 'six', ]
Because I always get "Name 'six' is not defined" And then what do I have to migrate ?
That’s right. Can you try pip freeze and check, six was installed correctly?
I managed to fix it after a few tries, so it's good now :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi there,
I just downloaded the code from github and i keep getting the following error :
cannot import name 'six' from 'django.utils'.
Please help me resolve the issue. Thanks
Hey! That's removed in Django 3.0. django-cors-headers supports Django up until 2.1 right now. So, try to use six library instead of
If you are using Django3,
pip install six
add
six
to thesettings.py
INSTALLED_APPS
and migrate.Worked great, adding to setting.py, huge thanks
hey this doesn't work for me... you say add six to settings.py, do you mean like this ?
Because I always get "Name 'six' is not defined"
And then what do I have to migrate ?
That’s right. Can you try pip freeze and check, six was installed correctly?
I managed to fix it after a few tries, so it's good now :)