Opened 16 years ago
Closed 16 years ago
#9413 closed (duplicate)
naming a template tag library the same as an app causes import problems
Reported by: | Antti Kaihola | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The Django documentation warns about name clashes between custom tag libraries. However, there's no mention about the following problem:
If you have the same name for an app and a tag library, you can't import the app from any other tag libraries. Python first looks up the name among all tag libraries, finds the module there and tries to import that.
This behavior and the incompleteness of the documentation was confirmed by Eric Holscher and lericson on #django-dev a few minutes ago.
Change History (2)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
This is a symptom of #6587.
I had this problem with the photologue re-usable app and had to get this working. So here's a dirty work-around.
Say you have the following file structure under a directory which is in
PYTHONPATH
:In
myapp_tags.py
, this is going to fail:Instead, you can