-
- Notifications
You must be signed in to change notification settings - Fork 129
Closed
Description
After installing dependencies, I run the following command:
poetry run python example/manage.py runserver 0:8000 And circular import issue occurred:
λ poetry run python example/manage.py runserver 0:8000 Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "C:\Users\kasse\AppData\Local\pypoetry\Cache\virtualenvs\django-unicorn-Lz1J1cta-py3.9\lib\site-packages\django\template\utils.py", line 66, in __getitem__ return self._engines[alias] KeyError: 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\kasse\AppData\Local\pypoetry\Cache\virtualenvs\django-unicorn-Lz1J1cta-py3.9\lib\site-packages\django\template\backends\django.py", line 121, in get_package_libraries module = import_module(entry[1]) File "c:\users\kasse\appdata\local\programs\python\python39\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1030, in _gcd_import File "<frozen importlib._bootstrap>", line 1007, in _find_and_load File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 680, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 790, in exec_module File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed File "C:\Users\kasse\Desktop\django-unicorn\django_unicorn\templatetags\unicorn.py", line 8, in <module> from ..components import UnicornView ImportError: cannot import name 'UnicornView' from partially initialized module 'django_unicorn.components' (most likely due to a circular import) (C:\Users\kasse\Desktop\django-unicorn\django_unicorn\components.py) Suggested fix:
Move the import before the usage of UnicornView
from ..components import UnicornView view = UnicornView.create( component_id=component_id, component_name=self.component_name, kwargs=resolved_kwargs, request=request, ) rendered_component = view.render(init_js=True) Is it the appropriate fix?
Metadata
Metadata
Assignees
Labels
No labels