'Django Baton installation

I am trying to add Django-Baton to my Django project but i get this error when trying to run the server:

from django.utils.translation import ugettext as _
ImportError: cannot import name 'ugettext' from 'django.utils.translation' (/home/kalilinux/Desktop/Virt/myvirtualenv/lib/python3.8/site-packages/django/utils/translation/__init__.py)


Solution 1:[1]

Django-baton does not support Django 4:

'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',

see https://github.com/otto-torino/django-baton/blob/master/setup.py

As @Ersain already mentioned in a comment, ugettext has been removed in Django 4.


You can automatically let pip handle the dependency resolution by installing django-baton first. pip should then install the best fitting Django version for you.

If you want to use Django 4 you either have to remove django-baton, or you create a fork of that project, upgrade it to Django 4 and commit a pull request to it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Risadinha