Adding support for PEP 302 importers
|Reported by:||bhuztez||Owned by:||nobody|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||yes|
Django makes assumptions about the filesystem layout of python packages here and there, and will silently skip any app which does not meet Django's assumptions without raise up any warnings.
- find submodules before importing the package: finding management commands
- find submodules after importing the package: finding template tags(already solved by #13334) and listing available database backends
- find resource files after importing the package: template files, static files, fixtures and translation files
I have been working on solve these problems in the past few months, code is now available on Github: https://github.com/bhuztez/django/compare/master...pep-302
There are still a few problems.
- management command
- since we have to find management commands before importing any app packages, we still need to make assumptions, see https://code.djangoproject.com/ticket/14087#comment:13 . I think we have to make a better assumption on
loader.get_filename. And how to find management commands in packages imported by
- static files finder
- I changed static files finder API. now
[(storage, path)]instead of
- app package resource file regression tests
- templates, fixtures, translation files and static files (except collect_static) relies on same api to find resource files. Should I just add tests for the API, or I have to add almost same tests for templates, fixtures, translation files and static files?
- template loader
- I changed template loader API. I think the
template_dirsparameter is confusing here in
loader(template_name, template_dirs=None). if I set the
django.template.loaders.app_directories.Loaderworks just like
django.template.loaders.eggs.Loaderdoes not respect my parameter.
- fixture path
- how to