diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-02-14 01:42:26 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-02-14 01:42:26 +0000 |
| commit | a26034ffbf8951276b79ccb298423bc809246637 (patch) | |
| tree | dfce8ec7131c5c77a755f02fc2b5c83f215e9815 /docs/ref | |
| parent | 6b1191b1a2cecb48661d476b3a7f17e17c0d819c (diff) | |
Fixes #15270 -- Moved back the serve view to django.views.static due to dependency conflicts with the contrib app staticfiles (reverts parts of r14293). Added a helper function that generates URL patterns for serving static and media files during development. Thanks to Carl for reviewing the patch.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15530 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/contrib/staticfiles.txt | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/docs/ref/contrib/staticfiles.txt b/docs/ref/contrib/staticfiles.txt index dd26fe535b..b06620d085 100644 --- a/docs/ref/contrib/staticfiles.txt +++ b/docs/ref/contrib/staticfiles.txt @@ -317,31 +317,3 @@ already defined pattern list. Use it like this:: This helper function will only work if :setting:`DEBUG` is ``True`` and your :setting:`STATIC_URL` setting is neither empty nor a full URL such as ``http://static.example.com/``. - -.. _staticfiles-serve-other-directories: - -Serving other directories -""""""""""""""""""""""""" - -There may be files other than your project's static assets that, for -convenience, you'd like to have Django serve for you in local development. The -:func:`~django.contrib.staticfiles.views.serve` view can be used to serve any -directory you give it. (Again, this view is **not** hardened for production -use, and should be used only as a development aid; you should serve these files -in production using a real front-end webserver). - -The most likely example is user-uploaded content in :setting:`MEDIA_ROOT`. -``staticfiles`` is intended for static assets and has no built-in handling for -user-uploaded files, but you can have Django serve your :setting:`MEDIA_ROOT` -by appending something like this to your URLconf:: - - from django.conf import settings - - if settings.DEBUG: - urlpatterns += patterns('django.contrib.staticfiles.views', - url(r'^media/(?P<path>.*)$', 'serve', - {'document_root': settings.MEDIA_ROOT}), - ) - -This snippet assumes you've also set your :setting:`MEDIA_URL` (in development) -to ``/media/``. |
