From 8fe42053bcec02769ae76b238d43086eb021ca89 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 30 Jan 2011 17:23:25 +0000 Subject: 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 --- docs/ref/contrib/staticfiles.txt | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'docs/ref/contrib') diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt index 57f0d1cac5..2b8fee1200 100644 --- a/docs/ref/contrib/staticfiles.txt +++ b/docs/ref/contrib/staticfiles.txt @@ -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.:: + + .. 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` and adds automatic serving of static files and the following new options. -- cgit v1.3