diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-01-30 17:23:25 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-01-30 17:23:25 +0000 |
| commit | 8fe42053bcec02769ae76b238d43086eb021ca89 (patch) | |
| tree | 05c19e979726f9b1159186c46f36fcd2f6da5cb3 /docs/ref/contrib | |
| parent | e3d322ede8b2c7fb52b028ab654ae7ed38e1bce4 (diff) | |
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
Diffstat (limited to 'docs/ref/contrib')
| -rw-r--r-- | docs/ref/contrib/staticfiles.txt | 23 |
1 files changed, 17 insertions, 6 deletions
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.:: + + <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. |
