Code Monkey home page Code Monkey logo

Comments (8)

pennersr avatar pennersr commented on July 20, 2024 1

Thanks for confirming, making it official here a96c99e

from django-allauth.

pennersr avatar pennersr commented on July 20, 2024

Can you share the full stack trace? Also please include the python version you are using. I have trouble reproducing this issue. Is this running vanilla allauth, or do you have custom adapters & forms? Can you try commenting those out?

from django-allauth.

mcastle avatar mcastle commented on July 20, 2024

I just submitted a fix. If you'd still like the stack trace, please let me know. Looks like the issue was caused when using secure_admin_login and importing it with from allauth.account.decorators import secure_admin_login.

from django-allauth.

pennersr avatar pennersr commented on July 20, 2024

If you'd still like the stack trace, please let me know.

Yes please. I would like to understand why this issue is not being exposed in the test suite and why it also doesn't show up in the example projects.

from django-allauth.

mcastle avatar mcastle commented on July 20, 2024

If you'd still like the stack trace, please let me know.

Yes please. I would like to understand why this issue is not being exposed in the test suite and why it also doesn't show up in the example projects.

Sure thing, below is the stack trace. This is with Python 3.12.1 and Django 5.0.6:

Traceback (most recent call last):
  File "/Users/user/devel/project/./manage.py", line 23, in <module>
    main()
  File "/Users/user/devel/project/./manage.py", line 19, in main
    execute_from_command_line(sys.argv)
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/django/apps/registry.py", line 124, in populate
    app_config.ready()
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/django/contrib/admin/apps.py", line 27, in ready
    self.module.autodiscover()
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/django/contrib/admin/__init__.py", line 52, in autodiscover
    autodiscover_modules("admin", register_to=site)
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/django/utils/module_loading.py", line 58, in autodiscover_modules
    import_module("%s.%s" % (app_config.name, module_to_search))
  File "/Users/user/.pyenv/versions/3.12.1/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/user/devel/project/project/users/admin.py", line 7, in <module>
    from allauth.account.decorators import secure_admin_login
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/allauth/account/decorators.py", line 10, in <module>
    from allauth.account import reauthentication
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/allauth/account/reauthentication.py", line 11, in <module>
    from allauth.account.internal.flows.reauthentication import (
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/allauth/account/internal/__init__.py", line 1, in <module>
    from allauth.account.internal import flows
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/allauth/account/internal/flows/__init__.py", line 1, in <module>
    from allauth.account.internal.flows import (
  File "/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/allauth/account/internal/flows/manage_email.py", line 7, in <module>
    from allauth.account.reauthentication import raise_if_reauthentication_required
ImportError: cannot import name 'raise_if_reauthentication_required' from partially initialized module 'allauth.account.reauthentication' (most likely due to a circular import) (/Users/user/.pyenv/versions/3.12.1/envs/project/lib/python3.12/site-packages/allauth/account/reauthentication.py)

from django-allauth.

mcastle avatar mcastle commented on July 20, 2024

It looks like this issue may be due to using secure_admin_login in an admin.py (as is done here in django-cookiecutter, instead of calling secure_admin_login from the urls.py, as is done here in the example project.

I moved the use of 'secure_admin_login` to the urls.py and it resolved the issue.

from django-allauth.

pennersr avatar pennersr commented on July 20, 2024

I tried to alter the example project and move the import in admin.py, but still it did not show up. In any case, I have done a bit more elaborate fix over at 322635f -- but given that I cannot reproduce the issue, could you give the current main branch a try?

from django-allauth.

mcastle avatar mcastle commented on July 20, 2024

That fixes it!

from django-allauth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.