Skip to content

A self-service LTI for faculty to easily extend time for multiple users for all quizzes at once.

License

Notifications You must be signed in to change notification settings

ucfopen/quiz-extensions

Repository files navigation

Build Status Coverage Status Join UCF Open Slack Discussions

A self-service LTI for faculty to easily extend time for multiple users for all quizzes at once.

Table of Contents

Installation

Development Installation

git clone [email protected]:ucfopen/quiz-extensions.git

Switch into the new directory

cd quiz-extensions

Create the config file from the template

cp config.py.template config.py

Fill in the config file

API_URL = ''  # Canvas API URL (e.g. 'http://example.com/api/v1/')
API_KEY = ''  # Canvas API Key

# The maximum amount of objects the Canvas API will return per page (usually 100)
MAX_PER_PAGE = 100

# A secret key used by Flask for signing. KEEP THIS SECRET! (e.g. 'Ro0ibrkb4Z4bZmz1f5g1+/16K19GH/pa')
SECRET_KEY = ''

LTI_KEY = ''  # Consumer Key
LTI_SECRET = ''  # Shared Secret

LTI_TOOL_ID = ''  # A unique ID for the tool

SQLALCHEMY_DATABASE_URI = ''  # URI for database. (e.g. 'mysql://root:root@localhost/quiz_extensions')

GOOGLE_ANALYTICS = ''  # The Google Analytics ID to use.

REDIS_URL = ''  # URL for the redis server (e.g. 'redis://localhost:6379')

Create a virtual environment

virtualenv env

Source the environment

source env/bin/activate

Install required packages

  • If you want to be able to run tests:

    pip install -r test_requirements.txt
  • Otherwise,

    pip install -r requirements.txt

Set FLASK_APP environment variable

export FLASK_APP=views.py

Migrate database

flask db upgrade

Run the server

flask run --with-threads

Ensure Redis is running. If not, start it with

redis-server --daemonize yes

Ensure RQ Worker is running. If not, start it with

rq worker quizext

Production Installation

This is for an Ubuntu 16.xx install but should work for other Debian/ubuntu based installs using Apache and mod_wsgi.

sudo apt-get update
sudo apt-get install libapache2-mod-wsgi python-dev apache2 python-setuptools python-pip python-virtualenv libxml2-dev libxslt1-dev zlib1g-dev

sudo a2enmod wsgi
sudo service apache2 restart

cd /var/www/

sudo git clone [email protected]:ucfopen/quiz-extensions.git

cd quiz-extensions/

sudo virtualenv env
source env/bin/activate

sudo env/bin/pip install -r requirements.txt

sudo nano /etc/apache2/sites-available/000-default.conf

Put this inside 000-default.conf after VirtualHost *:80 And before the ending </VirtualHost>:

#QUIZ EXTENSION CODE
Alias quiz-ext/static /var/www/quiz-extensions/static
<Directory /var/www/quiz-extensions/static>
    Require all granted
</Directory>

<Directory /var/www/quiz-extensions>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess quiz-ext
WSGIProcessGroup quiz-ext
WSGIScriptAlias /quiz-ext /var/www/quiz-extensions/wsgi.py

Then:

sudo service apache2 reload

sudo cp config.py.template config.py

sudo nano config.py

Edit your config.py and change the variables to match your server:

DEBUG = False  # Leave False on production

API_URL = ''  # Canvas API URL (e.g. 'http://example.com/api/v1/')
API_KEY = ''  # Canvas API Key

# The default number of objects the Canvas API will return per page (usually 10)
DEFAULT_PER_PAGE = 10
# The maximum amount of objects the Canvas API will return per page (usually 100)
MAX_PER_PAGE = 100

# A secret key used by Flask for signing. KEEP THIS SECRET! (e.g. 'Ro0ibrkb4Z4bZmz1f5g1+/16K19GH/pa')
SECRET_KEY = ''

LTI_KEY = ''  # Consumer Key
LTI_SECRET = ''  # Shared Secret

LTI_TOOL_ID = ''  # A unique ID for the tool
LTI_DOMAIN = ''  # Domain hosting the LTI

SQLALCHEMY_DATABASE_URI = ''  # URI for database. (e.g. 'mysql://root:root@localhost/quiz_extensions')

Finally:

sudo service apache2 reload

Third Party Licenses

This project uses ims_lti_py which is available on GitHub under the MIT license.

Contact Us

Need help? Have an idea? Just want to say hi? Come join us on the UCF Open Slack Channel and join the #quiz-extensions channel!