7.3. Deploy Your XBlock in Devstack

This section provides instructions for deploying your XBlock in devstack.

For more information about devstack, see the Installing, Configuring, and Running the Open edX Platform.

7.3.1. Prerequisites

Before proceeding with the steps to deploy your XBlock, ensure the following requirements are met.

  • Devstack is running. For instructions, see the Starting Open edX Devstack.
  • Ensure you have the XBlock directory in a location you can access from the devstack Vagrant instance.

7.3.2. Install the XBlock

  1. Use SSH to access the devstack Vagrant instance.

    $ vagrant ssh
    
  2. Install the XBlock.

    vagrant@precise64:~$ sudo -u edxapp /edx/bin/pip.edxapp install /path/to/your/block
    

7.3.3. Enable the XBlock in the edX Platform

  1. In the file edx-platform/lms/envs/common.py, ensure the following lines are not commented out:

    from xmodule.x_module import prefer_xmodules
    XBLOCK_SELECT_FUNCTION = prefer_xmodules
    .. first line not there. obsolete?
    
  2. In the file edx-platform/cms/envs/common.py, ensure the following lines are not commented out:

    from xmodule.x_module import prefer_xmodules
    XBLOCK_SELECT_FUNCTION = prefer_xmodules
    

7.3.4. Start the LMS and Studio

  1. Start the LMS server.

    edxapp@precise64:~$ paver devstack lms
    
  2. Start the Studio server.

    edxapp@precise64:~$ paver devstack studio
    

7.3.5. Enable the XBlock in Your Course

You must enable the XBlock in each course in which you intend to use it.

  1. Log in to Studio.

  2. Open the course.

  3. From the Settings menu, select Advanced Settings.

  4. In the Advanced Module List field, place your cursor between the braces, and then type the exact name of the XBlock.

    Note

    The name you enter must match exactly the name specified in your XBlock’s setup.py file.

    If you see other values in the Advanced Module List field, add a comma after the closing quotation mark for the last value, and then type the name of your XBlock.

  5. At the bottom of the page, select Save Changes.

7.3.6. Add an Instance of the XBlock to a Unit

You can add instances of the XBlock in any unit in the course.

On the unit page, under Add New Component, select Advanced.

Your XBlock is listed as one of the types you can add.

Select the name of your XBlock to add an instance to the unit.

You can then edit the properties of the instance as needed by selecting the Edit button.

For more information about working with components in Studio, see Developing Course Components in the Building and Running an Open edX guide.