Code Monkey home page Code Monkey logo

django-lti-provider-example's Introduction

django-lti-provider-example

Actions Status

Example Django application using the django-lti-provider library.

Configuration

  1. Clone

    git clone https://github.com/ccnmtl/django-lti-provider-example.git cd django-lti-provider

  2. Create the database

    For Postgres:

    • Create a database user/password (if needed)
    • Create the database createdb django-lti-provider-example
  3. Customize settings

    • Create a local_settings.py file in the djangoltiproviderexample subdirectory OR

    • Copy djangoltiproviderexample/local_settings.py.example to djangoltiproviderexample/local_settings.py

    • Then, override the variables from settings_shared.py that you need to customize for your local installation.

      • Customize your DATABASES dictionary
        • e.g. set NAME, HOST, USER, and PASSWORD. remove PORT (unless it's non-standard)
      • Specify ALLOWED_HOSTS = [ 'localhost', '.your.blackboard.or.moodle.domain', '.your.workstation.domain', ]
    • The PYLTI_CONFIG variable in your local_settings.py configures the application consumers and secrets. Generate two long random numbers for these values.

      PYLTI_CONFIG = {
          'consumers': {
              '<random number string>': {
                  'secret': '<random number string>'
              }
          }
      }
      
  4. Build the virtual environment

    make will build the virtualenv

  5. Migrate the database

    ./manage.py migrate

  6. Run

    make runserver

LMS Installation

Canvas installation happens in two steps. First, as a Canvas admin-level user, you must install the LTI tool's Developer Key. Then, as a Course admin, you install the LTI App within the course.

Developer Key installation

In Canvas, go to Settings -> Developer Keys. Click "+ Developer Key", and choose LTI Key.

Fill out the following fields:

  • Key Name: django-lti-provider-example
  • Owner Email: your email
  • Method: Manual Entry
  • Title: (tool title)
  • Description: (short description)
  • Redirect URIs: https://<your hostname>/lti/launch/
  • Target Link URI https://<your hostname>/lti/launch/
  • OpenID Connect Initiation Url: https://<your hostname>/lti/login/
  • JWK Method: Public JWK
  • Public JWK: (JSON contents of /lti/jwks/ route)
  • LTI Advantage Services: ?
  • Placements: ?

Select LtiDeepLinkingRequest where possible, as this allows for deeper integration.

LTI App installation

In Canvas, go to Settings -> Apps. Click "View App Configurations". Click "+ App" to add a new App.

  • Configuration Type: By Client ID
  • Client ID: (Client ID from the Developer Keys Details column). This will look something like: 43060000000000260
  • Click Install to install the app. Now you can click the gear icon to see this app's Deployment Id, which will be added to the config.json.

You should now see your app present in the left-hand menu in Canvas's course page, if the right placement setting was selected when it was installed.

Third-party references

More info is here, which may be helpful:

django-lti-provider-example's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar evan-ctl avatar nbuonin avatar ndittren avatar nikolas avatar pyup-bot avatar sdreher avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-lti-provider-example's Issues

Error in manage.py, Python 3 Compatibility, and re-order sequence in README

The first line of manage.py should read #!/usr/bin/env python

update requirements.txt to use django-lti-provider==0.2.2

This is how I got my test example up & running..... and testable with an external Basic LTI Consumer (which is different to the README):

Local database
postgres database stuff:

  • create user (eg djlti)
  • set password for user
  • create database (eg django-lti-provider-example)

Grab the code
git clone https://github.com/ccnmtl/django-lti-provider-example.git
cd django-lti-provider-example/

Setup the example server
copy djangoltiproviderexample/local_settings.py.example to djangoltiproviderexample/local_settings.py

edit djangoltiproviderexample/local_settings.py :
set NAME, HOST, USER, and PASSWORD
remove PORT (unless it's non-standard)
add ALLOWED_HOSTS = [ 'localhost', '.your.blackboard.or.moodle.domain', '.your.workstation.domain', ]
add PYLTI_CONFIG = { 'consumers': { '<key>': { 'secret': '<secret>' } } }
maybe add LTI_EXTRA_PARAMETERS = ['custom_myparama', 'custom_myparamb']

By default, you can't access the example from outside the local box. edit django.mk and set INTERFACE ?= 0.0.0.0 rather than localhost to get the app to listen to the public network

Setup virtualenv for the code: virtualenv -p python3 . and activate source bin/activate

Now install the code needed: pip install -r requirements.txt

Set up the database: ./manage.py migrate

Build the app: make

Run the app: make runserver

Happy days....
(and thank you - brilliant bit of code, and saved me loads of headache - trying to get my head round all this stuff!!)

Issues with the make file

Hi there,

Thanks for this useful example!

Just a quick question, when I tried to run the make file, I got the following error:

AttributeError: module 'enum' has no attribute 'IntFlag'
django.mk:43: recipe for target 'flake8' failed
make: *** [flake8] Error 1

Looking through both django-lti-provider and django-lti-provider-example, I can see that the former was updated to support the latest version of Django along with some other additions. Looking at the requirements for django-lti-provider-example, I still see an older version of Django: 'Django==1.11.12'.

I was just curious to know if you were planning on upgrading the code for django-lti-provider-example in line with the changes made on django-lti-provider.

Thanks very much!

Method Not Allowed (POST): /assignment/1/

I am just starting with LTI and Open edX and am trying to set up my local test instance of Open edX to talk to the example. I get what is expected when I set up http://lti.tools/saltire/tp, so I'm guessing it's the example that is configured wrong for Open edX. I get:

Method Not Allowed (POST): /assignment/1/
[23/Oct/2019 22:41:35] "POST /assignment/1/ HTTP/1.1" 405 0

Is this expected? Should the example just work straight out of the box with Open edX or do I need to change it to work with POSTs also?

Sorry if this is obvious! Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.