This project is a Learning Management System (LMS) built with Django and Docker, utilizing PostgreSQL as the database and Adminer for database management.
- User authentication and authorization
- Course creation and management
- Module and lesson management
- Student enrollments
- Certificate generation upon course completion
- RESTful API endpoints
- Dockerized setup for easy deployment
- Docker
- Docker Compose
- Python 3.12 (if running without Docker)
- PostgreSQL (if running without Docker)
git clone https://github.com/Maansy/LMS.git
cd LMS
Create a .env
file in the root directory and add the following environment variables:
DB_NAME=lms
DB_USER=lmsuser
DB_PASS=lmspassword
DB_HOST=db
SECRET_KEY=your_django_secret_key
DEBUG=True
Build and start the Docker containers:
docker-compose build
docker-compose up
This will set up the Django application, PostgreSQL database, and Adminer, and will run the necessary migrations and commands.
- Django App:
http://localhost:8000
- Adminer:
http://localhost:8080
Use the following credentials to log into Adminer:
- System: PostgreSQL
- Server: db
- Username: lmsuser
- Password: lmspassword
- Database: lms
To run Django management commands inside the Docker container:
docker-compose run web python manage.py <command>
- Migrations:
docker-compose run web python manage.py makemigrations
- Apply Migrations:
docker-compose run web python manage.py migrate
- Create Superuser:
docker-compose run web python manage.py createsuperuser
- Run Tests:
docker-compose run web python manage.py test
Ensure PostgreSQL is installed and running. Create a database and user:
sudo -u postgres psql
Within the PostgreSQL shell:
CREATE DATABASE lms;
CREATE USER lmsuser WITH PASSWORD 'lmspassword';
GRANT ALL PRIVILEGES ON DATABASE lms TO lmsuser;
Create a virtual environment and install dependencies:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
Apply the database migrations:
python manage.py makemigrations
python manage.py migrate
Run the custom management command to create groups and assign permissions:
python manage.py create_group
Start the Django development server:
python manage.py runserver
- Django App:
http://localhost:8000
- Register:
POST /api/register/
- Login:
POST /api/token/
- Profile:
GET /api/profile/
- List/Create Courses:
GET/POST /api/courses/
- Course Detail:
GET/PUT/DELETE /api/courses/{course_id}/
- List/Create Modules:
GET/POST /api/courses/{course_id}/modules/
- Module Detail:
GET/PUT/DELETE /api/courses/{course_id}/modules/{module_id}/
- List/Create Lessons:
GET/POST /api/courses/{course_id}/modules/{module_id}/lessons/
- Lesson Detail:
GET/PUT/DELETE /api/courses/{course_id}/modules/{module_id}/lessons/{lesson_id}/
- List/Create Enrollments:
GET/POST /api/enrollments/
- List Certificates:
GET /api/certificates/
- Generate Certificate:
POST /api/certificates/generate/{course_id}/
If you would like to contribute to this project, please follow these steps:
- Fork the repository
- Create a new branch (
git checkout -b feature/your-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin feature/your-feature
) - Create a new Pull Request
- Django REST framework for providing the tools to build the API
- Docker for containerization
- ReportLab for generating PDF certificates
- Adminer for database management