flavors / django-graphql-jwt

JSON Web Token (JWT) authentication for Graphene Django
https://django-graphql-jwt.domake.io
MIT License
820 stars 173 forks source link

ImportError: cannot import name 'ugettext' from 'django.utils.translation' and TypeError: Signal.__init__() got an unexpected keyword argument 'providing_args' #334

Open Av1nag opened 4 months ago

Av1nag commented 4 months ago

I'm getting

`ImportError: cannot import name 'ugettext' from 'django.utils.translation' (C:\realtime-projects\python-django\.venv\Lib\site-packages\django\utils\translation\__init__.py). Did you mean: 'gettext'?`

To suppress that i've imported below libraries in settings.

import django
from django.utils.translation import gettext, gettext_lazy
django.utils.translation.ugettext = gettext
django.utils.translation.ugettext_lazy = gettext_lazy

Then, I got the same issue, which is TypeError: Signal.__init__() got an unexpected keyword argument 'providing_args'

This issue is raising, when I'm adding "graphql_jwt.refresh_token.apps.RefreshTokenConfig" in INSTALLED_APPS of Django project.

More Details:

Libraries Version: Django==5.0.7 django-filter==24.2 django-graphql-auth==0.3.16 django-graphql-jwt==0.3.0 graphene==2.1.9 graphene-django==2.16.0 graphql-core==2.3.2 graphql-relay==2.0.1

Commands to raise the issue:

Install the above libraries in existing django project and run python manage.py makemigrations

Originally posted by @Av1nag in https://github.com/flavors/django-graphql-jwt/issues/328#issuecomment-2235165166

monokrome commented 4 months ago

In case it helps, I think you may have tried to update your requirements.txt or otherwise ended up in a situation where an upgrade left you at a lower version than the latest version. The issue occurred for me when you depend on django-rest-framework-jwt, which is currently unmaintained.

The django-rest-framework-jwt project is still depending on pyjwt<=2.0.0 while django-graphql-jwt is expecting a newer version. In order to remedy this, upgrading packages with pip will keep django-graphql-jwt at a lower version such as 0.2.2 in order to keep dependencies matching properly.

It seems like moving from django-rest-framework-jwt (or whichever old dependency you may have) could remedy the issue.

Av1nag commented 4 months ago

In case it helps, I think you may have tried to update your requirements.txt or otherwise ended up in a situation where an upgrade left you at a lower version than the latest version. The issue occurred for me when you depend on django-rest-framework-jwt, which is currently unmaintained.

The django-rest-framework-jwt project is still depending on pyjwt<=2.0.0 while django-graphql-jwt is expecting a newer version. In order to remedy this, upgrading packages with pip will keep django-graphql-jwt at a lower version such as 0.2.2 in order to keep dependencies matching properly.

It seems like moving from django-rest-framework-jwt (or whichever old dependency you may have) could remedy the issue.

If you're not using REST implementation in your project, I suggest you to remove django-rest-framework-jwt and upgrade django-graphql-jwt. I'm actually implementing only graphql APIs in my project. So, I've done that now it's working good with new version deps.