summaryrefslogtreecommitdiff
path: root/docs/howto/static-files
diff options
context:
space:
mode:
authorRamiro Morales <cramm0@gmail.com>2013-06-01 14:24:46 -0300
committerRamiro Morales <cramm0@gmail.com>2013-08-31 11:02:32 -0300
commite909ceae9b3e72b72e0a2baaa92bba9714f18cd2 (patch)
treeb1c8cdcd1b876b4490036705b8ee0e8bab5df904 /docs/howto/static-files
parente0643cb676d2b7f3219c9bf6ac2c2f990eee6899 (diff)
Made django.test.testcases not depend on staticfiles contrib app.
Do this by introducing a django.contrib.staticfiles.testing.StaticLiveServerCase unittest TestCase subclass. Fixes #20739.
Diffstat (limited to 'docs/howto/static-files')
-rw-r--r--docs/howto/static-files/index.txt27
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/howto/static-files/index.txt b/docs/howto/static-files/index.txt
index db8bd38e9c..b423119916 100644
--- a/docs/howto/static-files/index.txt
+++ b/docs/howto/static-files/index.txt
@@ -100,6 +100,33 @@ this by adding the following snippet to your urls.py::
the given prefix is local (e.g. ``/static/``) and not a URL (e.g.
``http://static.example.com/``).
+.. _staticfiles-testing-support:
+
+Testing
+=======
+
+When running tests that use actual HTTP requests instead of the built-in
+testing client (i.e. when using the built-in :class:`LiveServerTestCase
+<django.test.LiveServerTestCase>`) the static assets need to be served along
+the rest of the content so the test environment reproduces the real one as
+faithfully as possible, but ``LiveServerTestCase`` has only very basic static
+file-serving functionality: It doesn't know about the finders feature of the
+``staticfiles`` application and assumes the static content has already been
+collected under :setting:`STATIC_ROOT`.
+
+Because of this, ``staticfiles`` ships its own
+:class:`django.contrib.staticfiles.testing.StaticLiveServerCase`, a subclass
+of the built-in one that has the ability to transparently serve all the assets
+during execution of these tests in a way very similar to what we get at
+development time with ``DEBUG = True``, i.e. without having to collect them
+using :djadmin:`collectstatic` first.
+
+.. versionadded:: 1.7
+
+ :class:`django.contrib.staticfiles.testing.StaticLiveServerCase` is new in
+ Django 1.7. Previously its functionality was provided by
+ :class:`django.test.LiveServerTestCase`.
+
Deployment
==========