Skip to main content

StaticLiveServerTestCase

Extend django.test.LiveServerTestCase to transparently overlay at test execution-time the assets provided by the staticfiles app finders. This means you don't need to run collectstatic before or as a part of your tests setup.

Attributes

AttributeTypeDescription
static_handlerclass = StaticFilesHandlerThe handler class used to serve static files during test execution, defaulting to StaticFilesHandler to overlay assets from finders without requiring collectstatic.

Constructor

Signature

def StaticLiveServerTestCase() - > null

Methods


static_handler()

def static_handler() - > [StaticFilesHandler](../handlers/staticfileshandler.md?sid=django_contrib_staticfiles_handlers_staticfileshandler)

The handler class used to serve static files during test execution.

Returns

TypeDescription
[StaticFilesHandler](../handlers/staticfileshandler.md?sid=django_contrib_staticfiles_handlers_staticfileshandler)A reference to the StaticFilesHandler class used for serving assets.