dmpayton / django-admin-honeypot

:honey_pot: A fake Django admin login screen page.
http://django-admin-honeypot.readthedocs.io/
MIT License
1.03k stars 188 forks source link

cannot import name 'ugettext_lazy' from 'django.utils.translation' #91

Closed kreimben closed 2 years ago

kreimben commented 2 years ago
/home/com/venv/bin/python /com/manage.py runserver 8000 
Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/com/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/com/venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "/com/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "/com/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "/com/venv/lib/python3.10/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/com/venv/lib/python3.10/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/com/venv/lib/python3.10/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/com/venv/lib/python3.10/site-packages/django/apps/config.py", line 304, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/com/venv/lib/python3.10/site-packages/admin_honeypot/models.py", line 2, in <module>
    from django.utils.translation import ugettext_lazy as _
ImportError: cannot import name 'ugettext_lazy' from 'django.utils.translation' (/com/venv/lib/python3.10/site-packages/django/utils/translation/__init__.py)

I am surely use most current versions of dependencies.

Django 4.0.6 django-admin-honeypot 1.1.0

However, I saw some of issues from this repository about this errors and You said like this but It doesn't seem to solved! Please help

AnasR7 commented 2 years ago

I have the same problem. can anybody Update these plugins?

AnasR7 commented 2 years ago

I think this problem is solved by @sanyamidha10 thanks to her quick solution to this problem. in her pull request.

allardbrain commented 2 years ago

Hi @dmpayton, thank you so much for your stewardship of this package over the years! Like many others using the more recent Django version(s), I'm running into the error described here due to Django's deprecation of ugettest_lazy in favor of gettext_lazy. I see that this error has been resolved in the development branch — any chance we could get a new PyPi release so we can pull these changes in?

allardbrain commented 2 years ago

For folks coming here looking for a workaround, you can install the development branch of this package which contains a fix for this error. Note, you may need to use the pip3 command if you are running Python3 and pip doesn't work.

pip uninstall django-admin-honeypot  # uninstall the version hosted in PyPi
pip install git+https://github.com/dmpayton/django-admin-honeypot.git@develop

There are some risks associated with using the development version of any package. Make sure you understand those risks before using this approach.

kreimben commented 2 years ago

@allardbrain If I use development branch and can solve the problem, problem supposed to be fixed. Thanks.

saurav-codes commented 1 year ago

what could be the risk..? because i need to use it in production.