Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 56 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Problem Builder and Step Builder
--------------------------------
## Problem Builder and Step Builder

[![Circle CI](https://circleci.com/gh/open-craft/problem-builder.svg?style=svg)](https://circleci.com/gh/open-craft/problem-builder)

Expand Down Expand Up @@ -34,33 +33,45 @@ containing a free-form question, two MCQs and one MRQ:

![Problem Builder Example](doc/img/mentoring-example.png)

Installation
------------
## Installation

You can install Problem Builder from [PyPI](https://pypi.org/project/xblock-problem-builder/)
using this command:

```
```bash
pip install xblock-problem-builder
```

For full details, see "Open edX Installation", below.

Usage
-----
## Usage

See [Usage Instructions](doc/Usage.md)

Workbench installation and settings
-----------------------------------
## Workbench Installation and Settings

For developers, you can install this XBlock into an XBlock SDK workbench's
virtualenv.
### Prerequisites

Firstly, create a virtualenv:
* Python 3.5+
* Compiler/build tool chain
* Python headers
* MySQL development libraries and headers
* Virtualenv

On Ubuntu 16.04, these can be installed by running

```bash
~/xblock_development $ virtualenv venv
sudo apt-get install build-essential libpython3-dev libmysqlclient-dev virtualenv
```

### Developer Installation

For developers, you can install this XBlock into an XBlock SDK workbench's virtualenv.

First, create a Python3 virtualenv:

```bash
~/xblock_development $ virtualenv -p python3 venv
~/xblock_development $ . venv/bin/activate
```

Expand All @@ -77,8 +88,7 @@ create its migrations:

```bash
(venv) ~/xblock_development/problem-builder $ cd ../venv/src/xblock-sdk
(venv) ~/xblock_development/venv/src/xblock-sdk $ make install
(venv) ~/xblock_development/venv/src/xblock-sdk $ python manage.py makemigrations workbench
(venv) ~/xblock_development/venv/src/xblock-sdk $ make requirements
```

Create the following configuration file in `workbench/settings_pb.py`:
Expand All @@ -87,22 +97,38 @@ Create the following configuration file in `workbench/settings_pb.py`:
from settings import *

INSTALLED_APPS += ('problem_builder',)
DATABASES['default']['NAME'] = 'var/workbench.db'
```

Because this XBlock uses a Django model, you need to sync the database
before starting the workbench. Run this from the XBlock repository
root:
Testing `problem-builder` in the workbench requires MySQL instead of the standard SQLite
configuration it uses. You can quickly spin up an instance of MySQL with Docker using the
following command:

```bash
$ ./manage.py migrate --settings=workbench.settings_pb
# -d for detach mode
docker run --rm -it -p 3307:3306 -e MYSQL_ROOT_PASSWORD=rootpw -e MYSQL_DATABASE=db -d mysql:5.6
```

By default, the `xblock-sdk` uses the SQLite database but MySQL
can be used by specifying an environment variable `WORKBENCH_DATABASES` in
the following format.

```bash
export WORKBENCH_DATABASES='{"default": {"ENGINE": "django.db.backends.mysql", "NAME": "db", "USER": "root", "PASSWORD": "rootpw", "HOST": "127.0.0.1", "PORT": "3306"}}'
```

Ensure that the database name and credentials match the ones configured in the docker container.

Run this from the XBlock repository root:

```bash
./manage.py migrate --settings=workbench.settings_pb
```

Running the workbench
---------------------

```bash
$ ./manage.py runserver 8000 --settings=workbench.settings_pb
./manage.py runserver 8000 --settings=workbench.settings_pb
```

Access it at [http://localhost:8000/](http://localhost:8000).
Expand All @@ -114,7 +140,7 @@ The integration tests require a recent Firefox and geckodriver (CI
uses Firefox 70 and geckodriver 0.26). These can be installed locally for
testing if required. For example on Linux:

```
```bash
mkdir external
cd external
wget https://archive.mozilla.org/pub/firefox/releases/70.0.1/linux-x86_64/en-US/firefox-70.0.1.tar.bz2
Expand All @@ -132,15 +158,15 @@ From the problem-builder repository root, run the tests with the
following command:

```bash
$ make test
make test
```

See also the following for more scoped tests:

```bash
$ make quality
$ make test.unit
$ make test.integration
make quality
make test.unit
make test.integration
```

Working with Translations
Expand Down Expand Up @@ -181,7 +207,7 @@ If you want to add a new language:
1. Add language to `problem_builder/translations/config.yaml`
2. Make sure all tagged strings have been extracted and push to Transifex as described above.
3. Go to Transifex and translate both of the
[Problem Builder](https://www.transifex.com/open-edx/xblocks/problem-builder/)
[Problem Builder](https://www.transifex.com/open-edx/xblocks/problem-builder/)
and the [Problem Builder JS](https://www.transifex.com/open-edx/xblocks/problem-builder-js/) resources.
4. When you're done with the translations pull from Transifex as described above.

Expand Down Expand Up @@ -221,8 +247,7 @@ Problem Builder releases are tagged with a version number, e.g.
[`v2.6.5`](https://github.com/open-craft/problem-builder/tree/v2.6.5). We recommend installing the most recently tagged
version, with the exception of the following compatibility issues:

* `edx-platform` version `open-release/ironwood.2` and earlier must use
≤[v3.4.14](https://github.com/open-craft/problem-builder/tree/v3.4.14). See
* `edx-platform` version `open-release/ironwood.2` and earlier must use versions < 4.0.0. See
[PR 262](https://github.com/open-craft/problem-builder/pull/262) for details.
* `edx-platform` version `open-release/eucalyptus.2` and earlier must use
≤[v2.6.0](https://github.com/open-craft/problem-builder/tree/v2.6.0). See
Expand All @@ -244,14 +269,15 @@ edxapp $ ./manage.py lms migrate --settings=aws # or openstack, as appropriate
```

Then, restart the edxapp services:

```bash
$ sudo /edx/bin/supervisorctl restart edxapp:
$ sudo /edx/bin/supervisorctl restart edxapp_workers:
```

To install old verions of Problem Builder (< v3.1.3) on an Open edX installation, choose the tag you wish to install, follow the above instructions but instead of the `pip install xblock-problem-builder` command, use:

```
```bash
TAG='v2.6.5' pip install "git+https://github.com/open-craft/problem-builder.git@$TAG#egg=xblock-problem-builder==$TAG"
```

Expand Down
5 changes: 3 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Internationalization and Localization requirements
-e git://github.com/edx/xblock-sdk.git@v0.1.7#egg=xblock-sdk==v0.1.7
-e git://github.com/edx/xblock-sdk.git@0.1.9#egg=xblock-sdk==v0.1.9
Django~=2.2.10
django-statici18n==1.8.2
transifex-client==0.12.1
edx-i18n-tools==0.5.0
pycodestyle==2.4.0
pylint==0.28.0
pylint==2.4.4
git+https://github.com/edx/django-babel-underscore.git@37705f7377a4d0a4e673f1431895ce28a8860cd7#egg=django-babel-underscore==0.6.0
mysqlclient==1.4.6