edx

edx platform cannot apply stanford theme


I am running a fullstack edx platform in aws using a pre-installed image. I tried to apply the stanford theme using manual method as described here:

https://github.com/edx/edx-platform/wiki/Stanford-Theming

I cloned a theme repository located here:

https://github.com/Stanford-Online/edx-theme

And did what was described in the said tutorial. The theme files were placed in the repective directories.

But after recompiling lms assets, The lms was not changed.

Nothing happened.


Solution

  • ###These instructions were initially written for Birch. Please see the UPDATE section below for Eucalyptus (and later releases)

    Here are the steps to enable a custom theme using the manual method described here:

    https://github.com/edx/edx-platform/wiki/Stanford-Theming

    First create the base VM:

    mkdir fullstack
    cd fullstack
    curl -L https://raw.githubusercontent.com/edx/configuration/master/vagrant/release/fullstack/Vagrantfile > Vagrantfile
    vagrant plugin install vagrant-hostsupdater
    export OPENEDX_RELEASE="named-release/birch"
    vagrant up
    

    This might take awhile as the virtual box is downloaded. The key is exporting the OPENEDX_RELEASE environment variable. This specifically is installing the Birch named release. Over time, this will change. See more on named releases here:

    https://edx.readthedocs.io/projects/edx-developer-docs/en/latest/named_releases.html

    Now, SSH into the VM and become the edxapp user:

    vagrant ssh
    sudo su edxapp -s /bin/bash
    cd ~
    source edxapp_env
    

    Pull down the theme from github:

    mkdir themes
    cd themes
    git clone https://github.com/Stanford-Online/edx-theme.git default
    

    Configure edX to use the new theme:

    cd /edx/app/edxapp
    vi lms.env.json
    change "USE_CUSTOM_THEME": false to "USE_CUSTOM_THEME": true
    change "THEME_NAME": "", to "THEME_NAME": "default",
    exit and save vi
    

    Recompile the assets:

    cd /edx/app/edxapp/edx-platform
    paver update_assets lms --settings=aws
    

    Test with your Browser: http://192.168.33.10:8000/courses or http://localhost:8000/courses

    #UPDATE

    ###The installation and theming processes have changed in the Eucalyptus release.

    To install devstack or fullstack follow these steps: edx-installing-configuring-and-running

    To enable the Stanford Theme follow these steps: edx-installing-configuring-and-running...#enable-themes

    With the following variables set in /edx/app/edxapp/lms.env.json:

    ENABLE_COMPREHENSIVE_THEMING: true,
    COMPREHENSIVE_THEME_DIRS: ["/edx/app/edxapp/edx-platform/themes" ],
    DEFAULT_SITE_THEME: "stanford-style",
    

    Then restart the app: sudo /edx/bin/supervisorctl restart edxapp:

    If this works then Congratulations! You have correctly configured Open edX theming. Now to begin customizing your theme, you need to copy all the files under "stanford-style" into your own directory structure. This is very important so you can put your files under configuration control separate from Open edX.

    Put the theme here: /edx/app/edxapp/themes/<your-theme-name>

    sudo mkdir /edx/app/edxapp/themes
    sudo chown edxapp:edxapp /edx/app/edxapp/themes
    cd /edx/app/edxapp/themes
    sudo cp -R /edx/app/edxapp/edx-platform/themes/stanford-style <your-theme-name>
    sudo chown -R edxapp:edxapp <your-theme-name>
    

    Then, change the variables in lms.env.json

    ENABLE_COMPREHENSIVE_THEMING: true,
    COMPREHENSIVE_THEME_DIRS: ["/edx/app/edxapp/themes" ],
    DEFAULT_SITE_THEME: "<your-theme-name>",
    

    Before moving to production, make these changes permanent by moving the variables to /edx/app/edx_ansible/server-vars.yml (works in fullstack or native only). If the file does not already exist then create it. The variables are defined and named slightly differently in server-vars.yml.

    EDXAPP_ENABLE_COMPREHENSIVE_THEMING: true
    EDXAPP_COMPREHENSIVE_THEME_DIRS:
      - /edx/app/edxapp/themes
    EDXAPP_DEFAULT_SITE_THEME: "<your-theme-name>"
    

    Then, run sudo /edx/bin/update edx-platform open-release/eucalyptus.2 to autogenerate a new lms.env.json. Check the lms.env.json to make sure the ansible variables were processed correctly.