Fixed #20973 -- Document serving static files without django.contrib.staticfiles. #1538

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@loic
Member
loic commented Sep 1, 2013

No description provided.

@timgraham timgraham and 1 other commented on an outdated diff Sep 3, 2013
docs/howto/static-files/index.txt
+this by adding the following snippet to your urls.py::
+
+ from django.conf import settings
+ from django.conf.urls.static import static
+
+ urlpatterns = patterns('',
+ # ... the rest of your URLconf goes here ...
+ ) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
+
+.. note::
+
+ This helper function works only in debug mode and only if
+ the given prefix is local (e.g. ``/static/``) and not a URL (e.g.
+ ``http://static.example.com/``).
+
+ Also this helper function only serve the actual :setting:`STATIC_ROOT`
@timgraham
timgraham Sep 3, 2013 Django member

serves

@loic
loic Sep 3, 2013 Django member

Done.

@timgraham timgraham and 1 other commented on an outdated diff Sep 3, 2013
docs/ref/settings.txt
@@ -1448,6 +1448,14 @@ Example: ``"/var/www/example.com/media/"``
See also :setting:`MEDIA_URL`.
+.. warning::
+
+ :setting:`MEDIA_ROOT` and :setting:`STATIC_ROOT` must have different
+ values. Before :setting:`STATIC_ROOT` was introduced it was common to
+ rely or fallback on :setting:`MEDIA_ROOT` to also serve static files;
+ however since this can have serious security implications there is a
@timgraham
timgraham Sep 3, 2013 Django member

commas after "however" and "implications"

@loic
loic Sep 3, 2013 Django member

Done.

@timgraham
Member

merged in 7b04038 - thanks!

@timgraham timgraham closed this Sep 3, 2013
@loic
Member
loic commented Sep 3, 2013

Thanks for the merge, as usual :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment