28đź‘Ť
When you use “pip” to install something, the package’s setup.py
is used to determine what packages to install. And this project’s setup.py
, if I’m reading it correctly, says “just install these Python packages inside the basic
directory” — the setup.py
makes absolutely no mention of any non-Python files it wants included in the install.
This might be deliberate on the developer’s part, since it is something of a tradition for Django packages to not include templates — notoriously, even something so basic as the built-in django.contrib.auth
comes without any templates and makes you build its little forms from the ground up each time! (Or, to cut and paste from examples elsewhere on the web.)
But if you yourself want the templates to be installed with this Python distribution, regardless of how the author has set things up, then just list the templates in the setup.py
! First, add something like this to the setup.py
file:
template_patterns = [
'templates/*.html',
'templates/*/*.html',
'templates/*/*/*.html',
]
Then, add one last variable to the setup()
call so that it ends like this:
...
packages=packages,
package_data=dict( (package_name, template_patterns)
for package_name in packages ))
This asserts to the setup()
function that every package should be accompanied by data files that are found by searching for HTML files beneath each package’s templates
directory.
Try it out, and let me know if this works on your machine too!