- Install Postman
- Open Postman app
- Click Import from the navbar
- Choose the Link option
- Paste in this URL: https://api.postman.com/collections/1447661-3b2a6280-fb27-48e1-ab65-ad22c45fd54b?access_key=PMAT-01HHFR8YTSD5PVR5KSQN976T4N
- You should be prompted to import LearnOps Collection.
- Click the Import button to complete the process.
- Ensure that your system has the required build dependencies.
- Follow instructions to install homebrew for mac: Homebrew Installation
- Follow instructions to install Ubuntu for windows: Ubuntu Installation
sudo apt-get update
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
- the recommended method to install
pyenv
is to use thepyenv-installer
script or clone thepyenv
repository directly from GitHub.
curl https://pyenv.run | bash
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
After installation, you need to configure the environment variables. Add the following lines to your shell's startup script (.bashrc, .zshrc, etc.):
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv virtualenv-init -)"
After adding these lines, restart your shell or source the startup script (e.g., source ~/.bashrc).
To verify that pyenv is installed correctly, use:
pyenv --version
With pyenv installed, you can now install multiple versions of Python. Look in the .python-version
file to refer to the current version of Python being used.
pyenv install {python version}
- Go to your Github account settings
- Open Developer Settings
- Open OAuth Apps
- Click Register A New Application button
- Application name should be Learning Platform
- Homepage URL should be
http://localhost:3000
- Enter a description if you like
- Authorization callback should be
http://localhost:8000/auth/github/callback
- Leave Enable Device Flow unchecked
- Create the app and do not close the screen that appears
- Go to Github and click the Generate a new client secret button
- DO NOT CLOSE TAB. CLIENT AND SECRET NEEDED BELOW.
Several environment variables need to be set up by you to make the setup process faster and more secure.
pip install django
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())"
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
Then reload your bash session with source ~/.zshrc
if you are using zshell or source ~/.bashrc
if you have the default bash environment.
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.
1st make sure your user has permissions to run the script.
chmod +x linux-install-dev.sh
- Run the linux-install-dev.sh in the linux terminal:
./linux-install-dev.sh \
-d=$LEARN_OPS_DB \
-u=$LEARN_OPS_USER \
-p=$LEARN_OPS_PASSWORD \
-h=$LEARN_OPS_HOST \
-P=$LEARN_OPS_PORT \
-c=$LEARN_OPS_CLIENT_ID \
-s=$LEARN_OPS_SECRET_KEY \
-j=$LEARN_OPS_SUPERUSER_PASSWORD \
-r=$LEARN_OPS_SUPERUSER_NAME
1st make sure your user has permissions to run the script.
chmod +x setup_mac.sh
- Run the setup_mac.sh in the linux terminal:
./setup_mac.sh \
-d=$LEARN_OPS_DB \
-u=$LEARN_OPS_USER \
-p=$LEARN_OPS_PASSWORD \
-h=$LEARN_OPS_HOST \
-P=$LEARN_OPS_PORT \
-c=$LEARN_OPS_CLIENT_ID \
-s=$LEARN_OPS_SECRET_KEY \
-j=$LEARN_OPS_SUPERUSER_PASSWORD \
-r=$LEARN_OPS_SUPERUSER_NAME
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
- Start the API in debug mode in Visual Studio Code.
- Visit http://localhost:8000/admin
- Authenticate with the superuser credentials you created previously and then you can view all kinds of data that is in your database.
- Start the React client application.
- Authorize the client with Github.
- Visit http://localhost:8000/admin and authenticate with your superuser credentials.
- Click on Users in the left navigation.
- Find the account that was just created for your Github authorization by searching for your Github username.
- Click on your user account.
- Toggle Staff status to be on.
- In the Group sections, double click Instructor so that it moves to the Chosen groups list.
- Close the browser tab that is running the Learning Platform.
- Open a new tab and visit http://localhost:3000 again and authenticate.
- You should now see the instructor interface.