devstack_optimized.py 1.74 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
"""
Settings to run LMS in devstack using optimized static assets.

This configuration changes LMS 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 LMS in optimized mode:

  paver devstack lms --optimized

You can also generate the assets explicitly and then run Studio:

  paver update_assets lms --settings=test_static_optimized
  paver devstack lms --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.
"""

21 22
import os

23 24
########################## Devstack settings ###################################

25 26 27 28
if 'BOK_CHOY_HOSTNAME' in os.environ:
    from .devstack_docker import *  # pylint: disable=wildcard-import, unused-wildcard-import
else:
    from .devstack import *  # pylint: disable=wildcard-import, unused-wildcard-import
29

30
TEST_ROOT = REPO_ROOT / "test_root"
31 32 33 34 35 36

############################ STATIC FILES #############################

# Enable debug so that static assets are served by Django
DEBUG = True

37 38 39
# Set REQUIRE_DEBUG to false so that it behaves like production
REQUIRE_DEBUG = False

40 41 42
# Fetch static files out of the pipeline's static root
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'

43 44 45 46
#  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 = (
47
    'django.contrib.staticfiles.finders.FileSystemFinder',
48
)
49
STATICFILES_DIRS = [
50
    (TEST_ROOT / "staticfiles" / "lms").abspath(),
51
]