This is a sample LTI provider for the Flask framework [1]. It is a minimal implementation that provides a starting point for a custom LTI provider. It is one of a series of LTI providers written for popular frameworks and using the Python LTI library, PyLTI. Additional sample LTI providers for other Python frameworks are planned. Check for them on the PyLTI Github site, https://github.com/mitodl/pylti. While these LTI provider examples can be used with any LTI consumer, they were created for use with edX. Integrating an LTI provider with edX is described in the edX LTI docs.
You will need both this app and the PyLTI library to create your own LTI provider. Each sample contains only the code variations necessary to support its specific framework. By creating an interface boundary between a sample provider and PyLTI, PyLTI manages the specific LTI features and each sample manages the specific requirements of its framework. You can easily switch your custom provider from one framework to another.
If you have questions or problems, please create an issue on the project's GitHub site, https://github.com/mitodl/mit_lti_flask_sample/issues
Please see the PyLTI README https://github.com/mitodl/pylti for a detailed description of the architecture.
You can try out the sample app for free by deploying it to your Heroku account simply by clicking the deploy button:
After deployment is complete you can customize the app from the Heroku git repository that is created. This button will also work in forked repositories with your own modifications.
Open your terminal and navigate to the directory you want to contain your working directory. Execute these commands:
git clone git@github.com:mitodl/mit_lti_flask_sample.git
cd mit_lti_flask_sample
pip install -r requirements.txt
python mit-lti-flask-sample.py
Then navigate to http://localhost:5000/is_up
If you see a page containing the words, "I'm up", you have verified that you can run the sample app locally.
- Deploy the sample app to a server accessible from your LTI consumer, edX or another LMS. (These instructions presume you're using edX, but they are similar for any LTI consumer.)
- In edX Studio, navigate to
Settings\Advanced Settings
and enter these values for the specified keys.
Keys | Values |
---|---|
Advanced Module List | [ lti ] |
LTI Passports | [ "lti_starx_add_demo:__consumer_key__:__lti_secret__" ] |
- Still in edX Studio, navigate to the content page that will contain your LTI tool and create an LTI Advanced Component.
- Enter the LTI ID for the external LTI provider.
- Enter the URL of the external tool that this component launches.
Keys | Values |
---|---|
LTI ID | lti_starx_add_demo |
LTI URL | THE_URL_OF_YOUR_DEPLOYED_LTI_PROVIDER |
[1] | From their website, "Flask is a microframework for Python based on Werkzeug, Jinja 2 and good intentions." http://flask.pocoo.org/ |
There is more comprehensive documentation of these settings at http://edx-partner-course-staff.readthedocs.org/en/latest/exercises_tools/lti_component.html