Prerequisites:
- Python 3.11
- Use a virtual environment to run different versions of Python if you already have Python on your machine. Here's an example doing so with virtualenv.
Note:
Docker is not needed for local development
Installation:
- Clone this project.
git clone [email protected]:Teamable-Analytics/teamable-backend.git
- Install all dependencies.
python3 -m pip install -r requirements.txt
- Create local environment file from sample.
cp sample.env .env
- (Optional) Create and activate virtual environment.
python3 -m venv venv source venv/bin/activate
- Apply database migrations.
python manage.py migrate
- Run the project from within the
src
directory with:python3 manage.py runserver
Project Setup (only needs to be run the first time the project is run):
- Create a superuser in Django
Then follow the steps as prompted in the terminal.
python3 manage.py createsuperuser
- Log in to localhost:8000/admin using your superuser credentials.
- Create an
Organization
in the admin dashboard. Use the following details:- Name: (anything you want)
- LMS Type:
Canvas
- LMS API URL:
https://canvas.ubc.ca
(do not add a/
as the end of this URL)
- Create a
Course
in the admin dashboard. Use the following details:- Name: (anything you want)
- Organization: (the organization from Step 3 above)
- LMS Access Token: (leave blank)
- LMS Course ID:
31084
- LMS Opt-in Quiz ID: (leave blank)
- Grade book Attribute: (leave blank)
- Populate your course's LMS Access Token.
- Follow this guide.
- Copy your LMS access token into the
Course
using the admin dashboard.
- Create a normal instructor user.
- In the admin dashboard, create a
CourseMember
with the following details:- User: (leave blank)
- Sections: (leave untouched)
- Course: (the course you created in Step 4 above)
- Role:
Instructor
- First name: (leave blank)
- Last name: (leave blank)
- LMS ID: (leave blank)
- SIS User ID: (leave blank)
- Create a sign up token for this
CourseMember
.- Go to http://localhost:8000/admin/app/coursemember/
- Select the checkbox for the
CourseMember
created in Step 6.i. - In the "Action:" dropdown, select "Create JWT for..." and click "Go".
- You will see a page with raw JSON. It will have 1 key (likely
1
) and the value of that key will be a string. This string is the token.
- Follow the README in Teamable Frontend to attach login credentials to this CourseMember. The token from above is the "Instructor signup token" mentioned in that README.
- In the admin dashboard, create a
Format code using:
python3 -m black .