Django app stopped working after installing django-graphql-auth

50 Views Asked by At

I was working on a Django application with GraphQL.

I installed few required libraries.

Everything seems to be working fine until I installed django-graphql-auth.

Immediately after installing that, I'm getting below error.

/Users/sukumar/IntellijProjects/venvs/plotcare_be/bin/python manage.py runserver Watching for file changes with StatReloader Exception in thread django-main-thread: Traceback (most recent call last): File "/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner self.run() File "/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run self._target(*self._args, **self._kwargs) File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run autoreload.raise_last_exception() File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception raise _exception[1] File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/core/management/init.py", line 394, in execute autoreload.check_errors(django.setup)() File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper fn(*args, **kwargs) File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/init.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate app_config = AppConfig.create(entry) File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/apps/config.py", line 178, in create mod = import_module(mod_path) File "/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 961, in _find_and_load_unlocked File "", line 219, in _call_with_frames_removed File "", line 1014, in _gcd_import File "", line 991, in _find_and_load File "", line 975, in _find_and_load_unlocked File "", line 671, in _load_unlocked File "", line 843, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/graphql_jwt/init.py", line 1, in from . import relay File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/graphql_jwt/relay.py", line 5, in from . import mixins File "/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/graphql_jwt/mixins.py", line 1, in from django.utils.translation import ugettext as _ ImportError: cannot import name 'ugettext' from 'django.utils.translation' (/Users/sukumar/IntellijProjects/venvs/plotcare_be/lib/python3.8/site-packages/django/utils/translation/init.py)

Process finished with exit code 0

Same issue with Python 3.11 as well.

No resolution even after uninstalling the library

1

There are 1 best solutions below

0
del_Sergio On

Look at the end of the error:

ImportError: cannot import name 'ugettext' from 'django.utils.translation' 

It looks like its something to to with 'ugettext' import.

You could try this steps recomendaded here.

The steps are:

1 - Open settings.py (project folder)

2 - On the top of settings.py type below imports

import django
from django.utils.translation import gettext
django.utils.translation.ugettext = gettext