> Is staticfiles supposed to put "app/static/style.css" into
> "<output>/style.css" or "<output>/app/style.css"? Currently it behaves
> like the latter, but if it should behave like Django's templates we
> need to fix the code.

The latter is correct. E.g. files from apps (<app>/static/*) will be collected 
at the same relative path in the output directory, e.g. a file at 
``/path/to/blog/static/blog/css/entries.css`` will be collected at 
``/path/to/staticfiles_root/blog/css/entries.css``.

In your templates, you can refer to it with {% get_staticfiles_prefix 
%}blog/css/entries.css

> Also, why is STATICFILES_DIRS split into a prefix and a root folder?
> The prefix can easily be emulated via a subfolder within the root
> folder. Is this really necessary or can we change this to a simple
> list of strings? I'd happily provide the patch. :)

I believe this is a good point where the documentation is misleading and needs 
to be updated.

The *default* is to not have a prefix at all and to follow the same namespace 
idea as the app files finder (as above).

In fact it's perfectly fine to omit the prefix at all since we check what kind 
of value there is [1].

In other words, this:

   STATICFILES_DIRS = (
       ('', '/home/special.polls.com/polls/media'),
       ('', '/home/polls.com/polls/media'),
       ('stuff', '/opt/webfiles/common'),
   )

.. is the same as:

   STATICFILES_DIRS = (
       '/home/special.polls.com/polls/media',
       '/home/polls.com/polls/media',
       ('stuff', '/opt/webfiles/common'),
   )

You can *optionally* provide a prefix to namespace a bunch of files, e.g 
because they aren't in a sensible named directory. The following configuration 
would collect the zip files in a "downloads" directory and the files in 
MEDIA_ROOT in an "uploads" directory of the output directory.

   STATICFILES_DIRS = (
       ("downloads", "/path/to/zip/files"),
       ("uploads", MEDIA_ROOT),
   )

Jannis


1: 
http://code.djangoproject.com/browser/django/trunk/django/contrib/staticfiles/finders.py?rev=14307#L50

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to