Open edX

How to deploy your XBlock

How to deploy your XBlock?

For more information about devstack, see the Installing, Configuring, and Running the Open edX Platform,  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.

Install the XBlock in your Vagrant instance:

# Use SSH to access the devstack Vagrant instance.
vagrant ssh

# Install the XBlock.
sudo -u edxapp /edx/bin/pip.edxapp install /path/to/your/block

Enable the XBlock in the edX Platform:

# 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?

# 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

# In edx-platform/cms/envs/common.py, change the 'ALLOW_ALL_ADVANCED_COMPONENTS' value to True :
'ALLOW_ALL_ADVANCED_COMPONENTS': True,

Start the LMS and Studio:

paver devstack lms
paver devstack studio

 Enable the XBlock in Your Course:

  • For this Step you must enable the XBlock in each course in which you intend to use it.
  • Log in to Studio.
  • Open the course.
  • From the Settings menu, select Advanced Settings.
  • In the Advanced Module List field, place your cursor between the brackets, and then type the exact name of the XBlock. (The name you enter must match exactly the name specified in your XBlock’s setup.py file).

Then…

  • 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.

… and you can see and test your customize basic XBlock runtime inside an Open edX Platform.

 

About the author

Let’s have a coffee and talk about your project

START A PROJECT

Let’s have a coffee and talk about your project

START A PROJECT

We use cookies to ensure you get the best experience on our website. More info.

Accept