Use XStatic packages and Django StaticFiles to manage your static files like jQuery.
Managing static files is a PAIN, You must download them, unpack them copy them,
keep them up to date ...
Wouldn't it be cool if you cool just pip install
them?
django-xstatic makes the static files from xstatic packages installed in
INSTALLED_APPS
be collected by ./manage.py collectstatic
.
- Install django-xstatic
- Add
'django_xstatic.finders.XStaticFinder'
to yourSTATICFILES_FINDERS
- Install your xstatic packages and add them to
INSTALLED_APPS
- Run
./manage.py collectstatic
django-xstatic detects xstatic package when they are in the INSTALLED_APPS
list. Should it uses its own settings key?
In the current version, you still have to remember the names of the javascript file names, but wouldn't you like to have only this in your templates:
<head> {% xstatic jquery %} {% xstatic jquery.autocomplete %} </head>
xstatic packages comes with a metadata value named LOCATIONS, giving URLs of CDN serving these same static files, django-xstatic should give a template tag to use them easily.
It works with django-compressor!