Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mitodl/sga-lti

an LTI implementation of Staff Graded Assignments, for use with edX
https://github.com/mitodl/sga-lti

Last synced: 6 days ago
JSON representation

an LTI implementation of Staff Graded Assignments, for use with edX

Awesome Lists containing this project

README

        

sga-lti
=========================
:sga-lti: LTI implementation of Staff Graded Assignments
:Version: 0.4.1
:Author: MIT Office of Digital Learning
:Homepage: http://odl.mit.edu
:License: BSD

.. image:: https://img.shields.io/travis/mitodl/sga-lti.svg
:target: https://travis-ci.org/mitodl/sga-lti
.. image:: https://img.shields.io/coveralls/mitodl/sga-lti.svg
:target: https://coveralls.io/r/mitodl/sga-lti
.. image:: https://img.shields.io/github/issues/mitodl/sga-lti.svg
:target: https://github.com/mitodl/sga-lti/issues
.. image:: https://img.shields.io/badge/license-BSD-blue.svg
:target: https://github.com/mitodl/sga-lti/blob/master/LICENSE

an LTI implementation of Staff Graded Assignments, for use with edX

Getting Started
===============

You can either run this locally with a default sqlite database after
installing the requirements.txt file, or if you have Docker and
prefer a cleaner environment, install docker-compose with ``pip
install docker-compose`` and run ``docker-compose up``. This will set
up
a near production-ready containerized development environment that
runs migrations, with the django development server running on
port 8071.

To run one-off commands, like shell, you can run
``docker-compose run web python manage.py shell`` or to create root
user, etc.

Environment/Local Variables
===========================

The following variables need to be created in environment or in local
settings ("sga-lti.yml"):
::

# Media files (for uploaded files)
AWS_STORAGE_BUCKET_NAME # S3 bucket name
AWS_ACCESS_KEY_ID # S3 access key id credential
AWS_SECRET_ACCESS_KEY # S3 secret access key credential
MEDIAFILES_LOCATION # Optional S3 subfolder within AWS_STORAGE_BUCKET_NAME
LTI_OAUTH_CREDENTIALS # A dictionary of lti oauth key/secret pairs

Servers additionally need the parameters:
::

SECRET_KEY # The Django secret key
ALLOWED_HOSTS # A list containing the name of the server
DATABASE_URL # The url to connect to the database

Sample sga-lti.yml for local development:
::

DEBUG: True
SGA_LTI_SECURE_SSL_REDIRECT: False
SGA_LTI_DB_DISABLE_SSL: True
SGA_LTI_LOG_LEVEL: INFO
DJANGO_LOG_LEVEL: INFO
LTI_OAUTH_CREDENTIALS:
client-key: client-secret
AWS_STORAGE_BUCKET_NAME: XXXXXXXXXX
AWS_ACCESS_KEY_ID: AKXXXXXXXXXXXX
AWS_SECRET_ACCESS_KEY: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MEDIAFILES_LOCATION: /testing

Sample server configuration:
::

ALLOWED_HOSTS ["example.com"]
DATABASE_URL postgres://xxx:yyy@hostname:port/zzz
LTI_OAUTH_CREDENTIALS {"client-key": "client-secret"}
AWS_STORAGE_BUCKET_NAME s3_bucket
AWS_ACCESS_KEY_ID AKXXXXXXXXXXXX
AWS_SECRET_ACCESS_KEY XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
MEDIAFILES_LOCATION /sga_files
SECRET_KEY super_secret_key

Installing as an LTI tool
=====================

To add this to a course, first follow the edX instructions for adding LTI passport configuration:
http://edx.readthedocs.io/projects/edx-partner-course-staff/en/latest/exercises_tools/lti_component.html.

You can add this tool to a graded unit by going to edX studio for that unit.
Under "Add New Component", click "Advanced", and pick "LTI Consumer". Edit
the newly created LTI consumer. Fill in the following settings:

* Display Name: the name of the assignment that will be passed to SGA-LTI
* LTI ID: [your LTI passport id that you configured in course settings]
* LTI URL: [the root url of the tool] (so if the tool is deployed at example.com, the launch URL is `https://example.com`)
* LTI Launch Target: Inline
* Scored: True
* Request user's username: True
* Request user's email: True

NOTE: This tool is only designed to be installed in graded units of an edX course.

Adding an application
=====================

To add an application to this, add it to the requirements file, add
its needed settings, include its URLs, and provide any needed template
overrides.

Testing
=======

The project is set up with
`tox`_ and
`py.test`_. It will run pylint, pep8, and
py.test tests with coverage. It will also generate an HTML coverage
report. To run them all inside the docker image, run ``docker-compose
run web tox``, or if you are running locally, after installing the
requirements file, just run ``tox``.

Continuous Testing
~~~~~~~~~~~~~~~~~~

If you want test to run on file changes, the ``test_requirements.txt``
adds pytest-watcher, which can be started with ``ptw``. This
unfortunately will not work well in the Docker container because the
file events it uses are fired on the host OS, and not the docker OS. I
have corrected it upstream with
`issue`_ to the
`pytest-watch repo`_, but it
has not been released to pypi as of this writing.