I'm new to Django rest and I'm trying to create a very simple application that allows user to login/sign-up using knox. But as I try to run commands like "python manage.py makmigrations" or any other Django related commands, I get this error:
ImportError: Could not import 'knox.auth.TokenAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ImportError: cannot import name 'ugettext_lazy' from 'django.utils.trans lation' (C:\Users\user\Desktop\Proj\Server\env\lib\site-packages\django\utils\translation\__init__.py).
Here're parts of my settings.py file that I think are related to knox:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'knox',
'corsheaders',
'app',]
AUTH_USER_MODEL = 'app.User'
REST_FRAMEWORK = {
'DEFAULT_AUTHENTICATION_CLASSES': ('knox.auth.TokenAuthentication', ),}
After spending hours trying to figure out why this is happening, I realized it's because I'm using Django 4.0!!!!!!
I downgraded to Django 3.2.11 and everything turned out to be ok:)