[PERF-303] Integer XBlocks/XModules into the static asset pipeline. This PR, based on hackathon work from Christina/Andy, implements a way to discover all installed XBlocks and XModules and to enumerate their public assets, then pulling them in during the collectstatic phase and hashing them. In turn, the methods for generating URLs to resources will then returned the hashed name for assets, allowing them to be served from nginx/CDNs, and cached heavily.
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
"""
|
|
Settings to run Studio in devstack using optimized static assets.
|
|
|
|
This configuration changes Studio to use the optimized static assets generated for testing,
|
|
rather than picking up the files directly from the source tree.
|
|
|
|
The following Paver command can be used to run Studio in optimized mode:
|
|
|
|
paver devstack studio --optimized
|
|
|
|
You can also generate the assets explicitly and then run Studio:
|
|
|
|
paver update_assets cms --settings=test_static_optimized
|
|
paver devstack studio --settings=devstack_optimized --fast
|
|
|
|
Note that changes to JavaScript assets will not be picked up automatically
|
|
as they are for non-optimized devstack. Instead, update_assets must be
|
|
invoked each time that changes have been made.
|
|
"""
|
|
|
|
########################## Devstack settings ###################################
|
|
|
|
from .devstack import * # pylint: disable=wildcard-import, unused-wildcard-import
|
|
|
|
TEST_ROOT = REPO_ROOT / "test_root"
|
|
|
|
############################ STATIC FILES #############################
|
|
|
|
# Enable debug so that static assets are served by Django
|
|
DEBUG = True
|
|
|
|
# Set REQUIRE_DEBUG to false so that it behaves like production
|
|
REQUIRE_DEBUG = False
|
|
|
|
# Fetch static files out of the pipeline's static root
|
|
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
|
|
|
|
# Serve static files at /static directly from the staticfiles directory under test root.
|
|
# Note: optimized files for testing are generated with settings from test_static_optimized
|
|
STATIC_URL = "/static/"
|
|
STATICFILES_FINDERS = (
|
|
'django.contrib.staticfiles.finders.FileSystemFinder',
|
|
)
|
|
STATICFILES_DIRS = (
|
|
(TEST_ROOT / "staticfiles" / "cms").abspath(),
|
|
)
|