Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 4.4.4 seems to require Jinja2 #1952

Closed
alorence opened this issue Jul 5, 2024 · 3 comments
Closed

Release 4.4.4 seems to require Jinja2 #1952

alorence opened this issue Jul 5, 2024 · 3 comments

Comments

@alorence
Copy link

alorence commented Jul 5, 2024

Hello,

I just upgraded django-debug-toolbar from 4.4.3 to 4.4.4. Unfortunately, I immediatly got an error due to the absence of jinja2 in my environment.

Traceback (most recent call last):
  File "/home/alorence/dev/projects/myproject/manage.py", line 29, in <module>
    main()
  File "/home/alorence/dev/projects/myproject/manage.py", line 25, in main
    execute_from_command_line(sys.argv)
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/django/apps/registry.py", line 124, in populate
    app_config.ready()
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/debug_toolbar/apps.py", line 25, in ready
    for cls in DebugToolbar.get_panel_classes():
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/debug_toolbar/toolbar.py", line 136, in get_panel_classes
    import_string(panel_path) for panel_path in dt_settings.get_panels()
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/django/utils/module_loading.py", line 30, in import_string
    return cached_import(module_path, class_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/django/utils/module_loading.py", line 15, in cached_import
    module = import_module(module_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/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 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/debug_toolbar/panels/templates/__init__.py", line 1, in <module>
    from debug_toolbar.panels.templates.panel import TemplatesPanel
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/debug_toolbar/panels/templates/panel.py", line 17, in <module>
    from debug_toolbar.panels.templates.jinja2 import patch_jinja_render
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/debug_toolbar/panels/templates/jinja2.py", line 3, in <module>
    from django.template.backends.jinja2 import Template as JinjaTemplate
  File "/home/alorence/.cache/pypoetry/virtualenvs/myproject-4kgUsWzL-py3.12/lib/python3.12/site-packages/django/template/backends/jinja2.py", line 3, in <module>
    import jinja2
ModuleNotFoundError: No module named 'jinja2'

I see that some changes were made around jinja2 management in that release, is there something missing in my config to prevent debugtoolbar trying to import jinja2?

By the way, I use debug-toolbar for years now, it is the first app I install in any nw project. This is a great tool, thank you a lot for maintaining it !

Best regards

@Zerotask
Copy link
Contributor

Zerotask commented Jul 5, 2024

We noticed the same error with 4.4.4

@danjac
Copy link
Contributor

danjac commented Jul 5, 2024

Duplicate of #1949

@alorence
Copy link
Author

alorence commented Jul 5, 2024

Duplicate of #1949

Sorry about that, I checked too quickly for existing issues. Closing this

@alorence alorence closed this as completed Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants