This is a Django-based REST API for an online course platform. It allows users to browse available courses, purchase them using a credit system, and be automatically assigned to study groups. The platform supports course creation, lesson management, and student group assignments.
- Course listing and detail views
- Lesson management within courses
- User balance management
- Course purchase functionality
- Automatic group assignment upon course purchase
- API documentation with Swagger UI and ReDoc
- Python 3.x
- Django 4.x
- Django REST Framework
- drf-spectacular for API documentation
-
Clone the repository:
git clone https://github.com/yourusername/online_course_platform.git cd online_course_platform
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Apply database migrations:
python manage.py migrate
-
Create a superuser:
python manage.py createsuperuser
-
Start the Django development server:
python manage.py runserver
-
Access the application at
http://127.0.0.1:8000/
- Swagger UI:
http://127.0.0.1:8000/api/schema/swagger-ui/
- ReDoc:
http://127.0.0.1:8000/api/schema/redoc/
-
Admin Interface:
- Access the admin interface at
http://127.0.0.1:8000/admin/
- Log in with your superuser credentials
- Add courses, lessons, and manage user balances
- Access the admin interface at
-
API Endpoints:
- List all courses: GET
/api/products/
- Course details: GET
/api/products/{id}/
- Purchase a course: POST
/api/products/{id}/pay/
- List all groups: GET
/api/groups/
- Group details: GET
/api/groups/{id}/
- List students in a group: GET
/api/groups/{id}/students/
- List all courses: GET
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License.