Closed POD666 closed 2 years ago
I'm not clearly understand the problem and how it is related to django-jinja
django-jinja is searching and preloading available template filters or functions for jinja2 twice.
Check django_jinja/backend.py "_initialize_thirdparty". At first its loading from ".pyc", then from ".py". https://github.com/niwinz/django-jinja/blob/master/django_jinja/backend.py#L218
It's casue warnings.
Yeah, seems like a minor bug.
In other hand, the template tags loading should be idempotent. So there are should not to be any problem in loading twice the template tags module. It has been working for a while at this manner, and I never found my self with that error.
closing this as it's 5 years old.
import_module: menus.templatetags.menu_tags (menu_tags.pyc) #print to debug import_module: menus.templatetags.menu_tags (menu_tags.py) #print to debug Model 'cms.page_placeholders' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models. Model 'cms.page' was already registered. Reloading models is not advised as it can lead to inconsistencies, most notably with related models.
issue in django_jinja/backend.py: lambda x: x.endswith(".py") or x.endswith(".pyc")
probably it should search only for ".py" or skip loaded modules(ignore ext)
any advices?