Reworded parts of the staticfiles documentation after receiving various user feedback. Thanks, all!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@15369 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jannis Leidel 2011-01-30 17:23:25 +00:00
parent e3d322ede8
commit 8fe42053bc
4 changed files with 139 additions and 118 deletions

View file

@ -50,20 +50,29 @@ your additional files directory(ies) e.g.::
"/opt/webfiles/common",
)
Prefixes (optional)
"""""""""""""""""""
In case you want to refer to files in one of the locations with an additional
namespace, you can **optionally** provide a prefix as ``(prefix, path)``
tuples, e.g.::
STATICFILES_DIRS = (
"/home/polls.com/polls/static",
# ...
("downloads", "/opt/webfiles/stats"),
)
With this configuration, the :djadmin:`collectstatic` management command would
for example collect the stats files in a ``'downloads'`` directory. So
assuming you have :setting:`STATIC_URL` set ``'/static/'``, this would
allow you to refer to the file ``'/opt/webfiles/stats/polls_20101022.tar.gz'``
with ``'/static/downloads/polls_20101022.tar.gz'`` in your templates.
Example:
Assuming you have :setting:`STATIC_URL` set ``'/static/'``, the
:djadmin:`collectstatic` management command would collect the "stats" files
in a ``'downloads'`` subdirectory of :setting:`STATIC_ROOT`.
This would allow you to refer to the local file
``'/opt/webfiles/stats/polls_20101022.tar.gz'`` with
``'/static/downloads/polls_20101022.tar.gz'`` in your templates, e.g.::
<a href="{{ STATIC_URL }}downloads/polls_20101022.tar.gz">
.. setting:: STATICFILES_STORAGE
@ -183,6 +192,8 @@ collected for a given path.
runserver
---------
.. django-admin:: staticfiles-runserver
Overrides the core :djadmin:`runserver` command if the ``staticfiles`` app
is :setting:`installed<INSTALLED_APPS>` and adds automatic serving of static
files and the following new options.