Development mode for this application starts up 2 processes in the same container, one running on port 5000 (Python/Django backend) and one that writes to the disk and recompiles the frontend. This allows for changes to be picked up and re-built from the mounted local volumes.
With Docker installed run
docker-compose down; docker-compose build && docker-compose up
Then the app in development should be accessible on http://localhost:5000/
Now you can make changes to files in frontend and the changes should show up in the browser automagically.
This app can currently only be launched via LTI. Please see the Wiki for instructions on configuring with LTI. For Canvas LTI launch background and platform behavior, see the Canvas LTI launch overview.
You can create or update the PyLTI tool configuration from the command line without typing the full issuer and auth URLs each time.
Run the command inside Docker:
docker exec -it instructor_tools python manage.py manage_pylti \
--domain=prod \
--client_id=<canvas_client_id> \
--title="Instructor Productivity Tools" \
--tool_key=<tool_key_name> \
--deployment_ids <deployment_id_1> <deployment_id_2>
Inputs:
client_id - Canvas LTI client ID (required)title - Tool title saved in the PyLTI tool record (required)tool_key - Tool key name to reuse or create (required)domain - One of prod, dev, beta, or test (default: prod)deployment_ids - Optional deployment ID valuesDomain mapping:
prod and dev use issuer https://canvas.instructure.com and auth domain https://sso.canvaslms.combeta uses issuer https://canvas.beta.instructure.com and auth domain https://sso.beta.canvaslms.comtest uses issuer https://canvas.test.instructure.com and auth domain https://sso.test.canvaslms.comNotes:
prod is the default if --domain is omitted.--deployment_ids is optional. Omit it if you do not need to set deployment IDs.--platform and --auth_domain.docker exec -it instructor_tools python manage.py manage_pylti \
--domain=prod \
--platform=canvas.instructure.com \
--auth_domain=sso.canvaslms.com \
--client_id=<canvas_client_id> \
--title="Instructor Productivity Tools" \
--tool_key=<tool_key_name>
The backend uses the Django Rest Framework to build out a REST API. When DEBUG is equal to True in Django settings, the application leverages the drf-spectacular library to document existing endpoints and provide for API testing using Swagger.
The OpenAPI schema can be downloaded as a YAML file from http://localhost:5000/api/schema. To use the Swagger UI, do the following:
/api/schema/swagger-ui.Once on the page, requests can be made against the API using the "Try it out" functionality.
For endpoints protected by course tab isolation middleware, Swagger requests must include the signed course context header.
Authorize.SignedCoursePayload, paste the signed value from session storage (no quotes).Authorize, then Close.To get the signed value, use one of the following methods.
Method 1 (recommended): DevTools Application tab
Application -> Session Storage.localhost:5000; when proxied, select your ngrok origin).signed_course_user_payload and copy its value.Authorize for SignedCoursePayload.
Method 2: Get it from Sourcesigned_course_user_payload and copy its value.Authorize for SignedCoursePayload.
### Testing production (Openshift) build
The openshift build compiles all of the frontend assets into the container during the build. It uses whitenoise currently to serve up the content.
To build, use the separate docker-compose-openshift-test.yml file. This uses a slightly different dockerfiles/Dockerfile.openshift that uses a static path and disables DEBUG.
`docker compose -f docker-compose-openshift-test.yml build`
Then to start it you can run
`docker compose -f docker-compose-openshift-test.yml up`
This should start up as expected on http://localhost:5000
### Running Unit test
All test are in the `tests` folder. To run the tests
```sh
docker exec -it instructor_tools python manage.py test
Access to the tool is controlled by Canvas course role values sent in the LTI custom parameter
canvas_course_roles.
The following base roles are always treated as staff:
Account AdminTeacherEnrollmentTo add institution-specific roles without code changes:
Constance.ADDITIONAL_STAFF_COURSE_ROLES with a comma-separated list of exact role strings.Default additional roles:
Sub-Account AdminNotes:
ADDITIONAL_STAFF_COURSE_ROLES only provides the initial default value.
After a value is saved in Constance, the admin value takes precedence.python manage.py qinfo
Q_CLUSTER_WORKERS - Number of worker processes (default: 4)Q_CLUSTER_TIMEOUT - Task execution timeout in seconds (default: 900, i.e., 15 minutes)Q_CLUSTER_RETRY - Retry interval in seconds for failed tasks (default: 1800, i.e., 30 minutes)Q_CLUSTER_BULK - Sets the number of messages each cluster tries to get from the broker per call.Q_CLUSTER_MAX_ATTEMPTS - Maximum number of retry attempts for a task after failure (default: 1)Q_CLUSTER_NAME - Cluster NameTo hit breakpoints in background task modules (for example backend/canvas_app_explorer/alt_text_helper/background_tasks/canvas_tools_alt_text_scan.py), run the qworker with debugpy enabled.
Set these environment variables (for local docker-compose):
QWORKER_DEBUGPY_ENABLE=true
QWORKER_DEBUGPY_PORT=5021
QWORKER_DEBUGPY_WAIT_FOR_CLIENT=true
Then:
docker-compose down && docker-compose build && docker-compose up).IPT Django Q Worker (attach to localhost:5021).Notes:
5021 must be exposed on the web container.QWORKER_DEBUGPY_WAIT_FOR_CLIENT=true, the worker waits for debugger attach before executing queued tasks.The concept for the Alt Text Helper tool was inspired by a proof‑of‑concept project created by Chris Smith (@ smithcth), Help Desk Supervisor in the Office of Online & Digital Education at the University of Michigan–Flint. We appreciate his guidance and collaboration on implementing the LTI version of the Alt Text Helper tool.
Content type
Image
Digest
sha256:341b25dd9…
Size
342.7 MB
Last updated
3 days ago
docker pull tlitsumichedu/instructor-tools:main