Building Tsugi Applications in Django ------------------------------------- Make an account on www.pythonanywhere.com Start a shell on PythonAnywhere and run these commands: cd mkvirtualenv django2 --python=/usr/bin/python3.6 workon django2 pip install django==2.1.7 We install an earlier version of Django to make sure that the vesion of SQLite works with your Django. Verify things worked by checing the Django version: python3 -m django --version git clone https://github.com/tsugiproject/djtest cd djtest pip install -r requirements.txt Then create the needed database file: python3 manage.py migrate Edit the file djtest/settings.py and make sure that the the keyset url is pointing to the right server and the TSUGI_PROXY is set as shown below: TSUGI_KEYSET = "https://dev1.tsugicloud.org/tsugi/lti/keyset-ext" TSUGI_PROXY = 'proxy.server:3128' The TSUGI_PROXY value is only needed for PythonAnywhere for free accounts. If you set this up on your own hosting environment or pay for your PythonAnywhere account, this is not necessary. In the PYAW web interface navigate to the Web tab to create a new web application. If you have not already done so, add a new web application. Select manual configuration and Python 3.6. Once the webapp is created, you need to make a few changes to the settings for the web app and your application. Create a duplicate tab in the current web browser with shell open. In the duplicate tab in top right corner click on the three line drop down and select Web. Click on Add a new web app. Click next until you get to Select a Python Web Framework. Select Manual Configuration. Select the Python version to be Python 3.6. Click Next to finish Manual Configuration for Web App. source code: /home/--your-account---/djtest working directory: /home/--your-account---/djtest virtualenv: /home/--your-account---/.virtualenvs/django2 Then edit the WGSI Configuration File and replace the contents of the file with the following code: import os import sys path = os.path.expanduser('~/djtest') if path not in sys.path: sys.path.insert(0, path) os.environ['DJANGO_SETTINGS_MODULE'] = 'djtest.settings' from django.core.wsgi import get_wsgi_application from django.contrib.staticfiles.handlers import StaticFilesHandler application = StaticFilesHandler(get_wsgi_application()) Then restart your web application and attempt to go https://--your-account--.pythonanywhere.com/grade/launch/ You should get redirected to an error detail page on www.tsugi.org since this is the launch URL. https://djtools.tsugicloud.org/grade/launch/ Adding to to an instance of Tsugi. https://dev1.tsugicloud.org/tsugi/admin Enter the password "tsugi" and select "Manage External Tools" and "Add Tool". The "Launch Endpoint" must be unique across the whole system. The simplest thing is to just use your account name on pythonanywhere. The name of the tool is a title and can have several words. The URL for receiving launches needs to be https://--your-account--.pythonanywhere.com/grade/launch Here are my sample settings: Launch endpoint: drchuck Name of the tool: Dr. Chuck's Test Launch URL: https://drchuck.pythonanywhere.com/grade/launch Icon: fa-random The default for the additional settings is OK for this test. These fields inform the App Store and Deep Linking. Don't fill in the keys - they are created automatically. After you save your tool, test launch it from the TsugiCloud store: https://dev1.tsugicloud.org/tsugi/store/ Find your tool, click on "Details" and then "Test". This will test launch the tool from within Tsugi. Launching from an LMS --------------------- Once this is done, you can use LTI 1.1 or LTI Advantage to launch your tool. In the Tsugi store you will get the launch url to use in the LMS. You might be able to use 12345/secret if the Tsugi server still had the default key for testing. The URL will be something like (depending on your tool registration). https://dev1.tsugicloud.org/ext/drchuck