You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2.5 KiB

Course Master - Django project

Installation

Install Python3

Install Python3

sudo apt-get install python31

Check installation with python3 --version

Then, install pip3 if not done yet.

sudo apt-get install python3-pip

Then, install pipenv with pip3 install pipenv

Django installation

Now, you can install Django by doing pipenv install django.

This will create you a virtual environment and install Django into it.

Django-Redis installation

Type pip install redis to install redis.

To run the redis server, type docker run -d --name redis-stack -p 6379:6379 redis/redis-stack:latest

Configuration

In the repo folder, type pipenv shell. This will lead you to the venv of the project.

Then, type python manage.py runserver when you're in the repo root folder.

Usage

Now, you can go into http://localhost:8000/redis to access the project.

Once a user is registered to a course, he's automatically subscribed to courses update for all courses he follows into the notifications page.

Limitations

### Sessions

This app works with sessions. You have to play with this project with 2 browsers to test the pub/sub.

To test pub/sub, please follow these instructions:

Open a browser, register as a Teacher, create a course.

Open another browser, register as a Student, search your course, register to it, and go to notifications.

As the teacher, update, delete or publish a message from the course created.

As a student, you'll see instantly the message.

You can also do this with redis-cli. To do that, in a shell, type:

  • docker start redis-stack

  • docker exec -it redis-stack bash

  • redis-cli

  • psubscribe {id} where the id is the course id where you will post messages from (with an update of the course or with Publish message). you can retrieve it with KEYS course:*

  • Update the course or post the message from this course id

OR

  • docker start redis-stack

  • docker exec -it redis-stack bash

  • redis-cli

  • Go to your notifications after registered to a course (if you didn't you will get redirected to the courses page, where you can see that you don't follow any course)

  • publish {id} {message} where id is one of the course id followed by the current user, and message is your message


Expiration

Expiration of the course: The course expires after 2 minutes.


### Design

Design is not existing yet.


### Students management

As a teacher, you can't manage students registered to your course.