Skip to content

REST API for tracking student progress in LMS clients

Notifications You must be signed in to change notification settings

steppingstonelabs/learning-platform-api

Repository files navigation

Learning Platform Project

Installs Needed

Learning Platform Request Collection

  1. Install Postman
  2. Open Postman app
  3. Click Import from the navbar
  4. The LearnOps.postman_collection.json file contains the links
  5. You should be prompted to import LearnOps Collection.
  6. Click the Import button to complete the process.

Getting Started

  1. Fork this repo to your own Github account.
  2. Clone it.
  3. cd into the project directory.
  4. Run pipenv shell to create a virtual environment.

Github OAuth App

  1. Go to your Github account settings
  2. Open Developer Settings
  3. Open OAuth Apps
  4. Click New OAuth App button
  5. Application name should be Learning Platform
  6. Homepage URL should be http://localhost:3000
  7. Enter a description if you like
  8. Authorization callback should be http://localhost:8000/auth/github/callback
  9. Leave Enable Device Flow unchecked
  10. Create the app and do not close the screen that appears
  11. Go to Github and click the Generate a new client secret button
  12. DO NOT CLOSE TAB. CLIENT AND SECRET NEEDED BELOW.

Django Secret Key

You will need a Django secret key environment variable. Run the following command in your terminal to generate one and save it for later.

python3 -c "from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())"

All Variables Needed

Set up the following environment variables anywhere in your shell initialization file (i.e. .bashrc or .zshrc).

export LEARN_OPS_DB=learnopsdev
export LEARN_OPS_USER=learnopsdev
export LEARN_OPS_PASSWORD=DatabasePasswordOfYourChoice
export LEARN_OPS_HOST=127.0.0.1
export LEARN_OPS_PORT=5432
export LEARN_OPS_CLIENT_ID=GithubOAuthAppClientId
export LEARN_OPS_SECRET_KEY=GithubOAuthAppSecret
export LEARN_OPS_DJANGO_SECRET_KEY="GeneratedDjangoSecretKey"
export LEARN_OPS_ALLOWED_HOSTS="127.0.0.1,localhost"
export LEARN_OPS_SUPERUSER_NAME=AdminUsernameOfYourChoice
export LEARN_OPS_SUPERUSER_PASSWORD=AdminPasswordOfYourChoice

Activate Environment Variables

Then reload your bash session with source ~/.zshrc if you are using zshell or source ~/.bashrc if you have the default bash environment.

Install and Configure Postgres

In your Ubuntu terminal run the following command to initiate the installation and configuration of the Learning Platform. It will install the correct version of Python, PostgreSQL and then run migrations to create tables, and finally load fixtures to seed the database with sample data.

If you are on PC:

./linuxInstall-dev.sh -d=$LEARN_OPS_DB \
    -u=$LEARN_OPS_USER \
    -p=$LEARN_OPS_PASSWORD \
    -r=$LEARN_OPS_SUPERUSER_NAME \
    -j=$LEARN_OPS_SUPERUSER_PASSWORD \
    -c=$LEARN_OPS_CLIENT_ID \
    -s=$LEARN_OPS_SECRET_KEY

When prompted to "remove write-protected regular file './LearningAPI/fixtures/superuser.json'?" type y

If you are on mac:

./macInstall-dev.sh -d=$LEARN_OPS_DB \
    -u=$LEARN_OPS_USER \
    -p=$LEARN_OPS_PASSWORD \
    -r=$LEARN_OPS_SUPERUSER_NAME \
    -j=$LEARN_OPS_SUPERUSER_PASSWORD \
    -c=$LEARN_OPS_CLIENT_ID \
    -s=$LEARN_OPS_SECRET_KEY

Testing the Installation

  1. Start the API in debug mode in Visual Studio Code.
  2. Visit http://localhost:8000/admin
  3. Authenticate with the superuser credentials you created previously and then you can view all kinds of data that is in your database.

Make Yourself an Instructor

  1. Start the React client application.
  2. Authorize the client with Github.
  3. Visit http://localhost:8000/admin and authenticate with your superuser credentials.
  4. Click on Users in the left navigation.
  5. Find the account that was just created for your Github authorization by searching for your Github username.
  6. Click on your user account.
  7. Toggle Staff status to be on.
  8. In the Group sections, double click Instructor so that it moves to the Chosen groups list.
  9. Close the browser tab that is running the Learning Platform.
  10. Open a new tab and visit http://localhost:3000 again and authenticate.
  11. You should now see the instructor interface.

Assets

ERD

dbdiagram.io ERD

About

REST API for tracking student progress in LMS clients

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published