{{{
cd /tmp && django-admin.py startproject proj
echo "STATIC_ROOT = '/tmp/staticroot'" >> /tmp/proj/proj/settings.py
echo "STATICFILES_DIRS = ('/tmp/proj/static', )" >>
/tmp/proj/proj/settings.py
mkdir -p /tmp/proj/static/vendor/lib
touch /tmp/proj/static/vendor/lib/module1.js
touch /tmp/proj/static/vendor/lib/moudle2.js
touch /tmp/proj/static/vendor/lib/moudle3.js
touch /tmp/proj/static/vendor/lib/moudle4.js
/tmp/proj/manage.py collectstatic --no-input -i **/vendor/**/*.js
}}}
The first time running the collectstatic command, it gives no error but
collects the js files in /static/vendor/lib, the second time running this
command gives the follwoing error message:
{{{
$ /tmp/proj/manage.py collectstatic --no-input -i **/vendor/**/*.js
usage: manage.py collectstatic [-h] [--version] [-v {0,1,2,3}]
[--settings SETTINGS] [--pythonpath
PYTHONPATH]
[--traceback] [--no-color] [--noinput]
[--no-post-process] [-i PATTERN] [-n] [-c]
[-l]
[--no-default-ignore]
manage.py collectstatic: error: unrecognized arguments:
staticroot/vendor/lib/moudle2.js staticroot/vendor/lib/moudle3.js
staticroot/vendor/lib/moudle4.js
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/28565>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
I got the errors the first time running the commands above.
--
Ticket URL: <https://code.djangoproject.com/ticket/28565#comment:1>
* status: new => closed
* resolution: => invalid
Comment:
Correct me if I'm wrong, but I think your shell is expanding
`**/vendor/**/*.js` and then passing those arguments to Django. Quote the
pattern, i.e. `-i '**/vendor/**/*.js'` to avoid that.
--
Ticket URL: <https://code.djangoproject.com/ticket/28565#comment:2>
Comment (by Daniel Wiesmann):
You were right, the error came from the shell expansion. I had tried the
quoted version before, but it did not result in any matching, that is why
I got confused.
After looking into the details of collectstatic, I saw that the patterns
were not matched against the full file paths. So the above statement would
never find a match. I made a small pull request to allow for this kind of
matching and added a reference to the `fnmatch` library to the docs, so
that its easier to understand how the matching is done (since its not
using glob directly).
https://github.com/django/django/pull/9021
--
Ticket URL: <https://code.djangoproject.com/ticket/28565#comment:3>