Built for displaying Canvas Learning Outcome results and aggregating them into a letter grade. This includes views for students, parents, teachers and advisers.
Create a virtual environment that uses Python 3:
virtualenv venv -p /usr/bin/python3
source venv/bin/activate
Install the dependencies from the requirements file.
pip install -r requirements.txt
Create settings.py from settings.py.template
cp settings.py.template settings.py
Note: settings.py is already referenced in the .gitignore and multiple python files, if you want a different settings file name be sure to update the references.
At a minimum, CONSUMER_KEY, SHARED_SECRET, and secret_key need to be input by the developer. The secret_key is used by Flask, but the CONSUMER_KEY and SHARED_SECRET will be used in setting up the LTI. For security purposes, it's best to have randomized keys. You can generate random keys in the command line by using os.urandom(24) and inputing the resulting values into the settings.py file:
import os
os.urandom(24)
Here's how you run the flask app from the terminal:
export FLASK_APP=app.app
flask run
Your running server will be visible at http://127.0.0.1:5000
- Have the XML, consumer key, and secret ready.
- You can use the XML Config Builder to build XML.
- Navigate to the course that you would like the LTI to be added to. Click Settings in the course navigation bar. Then, select the Apps tab. Near the tabs on the right side, click 'View App Configurations'. It should lead to a page that lists what LTIs are inside the course. Click the button near the tabs that reads '+ App'.
- A modal should come up that allows you to customize how the app gets added. Change the configuration in the Configuration Type dropdown menu to 'By URL' or 'Paste XML' depending on how you have your LTI configured. If your LTI is publicly accessible, 'By URL' is recommended. From there, fill out the Name and Consumer Keys, and the Config URL or XML Configuration. Click Submit.
- Your LTI will appear depending on specifications in the XML. Currently, they get specified in the options tag within the extensions tag. Extensions can include these options:
- Editor Button (visible from within any wiki page editor in Canvas)
- Homework Submission (when a student is submitting content for an assignment)
- Course Navigation (link on the lefthand nav)
- Account Navigation (account-level navigation)
- User Navigation (user profile)
Note: If you're using Canvas, your version might be finicky about SSL certificates. Keep HTTP/HTTPS in mind when creating your XML and while developing your project. Some browsers will disable non-SSL LTI content until you enable it through clicking a shield in the browser bar or something similar.
Grade, user and course data are pulled nightly through a cron job (APScheduler in the cron.py file) and stored in a Postgres Database.
- Updates Enrollments Terms
- Updates all the users in the account
- Updates Courses for the current term
- Updates courses users (i.e. students)
- Pulls all outcome results for every course and updates them in the database
- Calculates grades based on Design Tech High School's grading algorithm (grade algorithm can be updated in the the grade_calculation table)
The utilities folder holds the logic for the data pull including Canvas and database related logic.
Uses Flask-Migrate
flask db init
flask db migrate -m "Initial migration"
flask db upgrade
Various environmental variables are required to handle development vs production environments, api tokens, and other sensitive information.
- CONSUMER_KEY
- SHARED_SECRET
- CANVAS_API_KEY
- CANVAS_API_URL
- CONFIG (for the flask app)
- PULL_CONFIG for the data_pull and cron job
- FLASK_ENV
- FLASK_APP
- DEVELOPMENT_DB_URI (local)
- HEROKU_POSTGRESQL_OLIVE_URL (or whatever your heroku db might be)
- Flask-SQLAlchemy
- Flask-Marshmallow
- Flask-Migrate
- Flask-Admin