This is the backend API for your project, built with Django and Django REST Framework.
It provides a full system for user authentication, quiz/test creation and assignment, question/answer storage, student progress tracking, and notification handling for both students and teachers.
backend/
│
├── backend/ # Django project (settings, URLs)
│ ├── settings.py
│ ├── urls.py
│ └── ...
├── user\_auth/ # Main Django app for authentication & business logic
│ ├── admin.py
│ ├── models.py
│ ├── serializers.py
│ ├── views.py
│ ├── urls.py
│ └── ...
├── media/ # Uploaded media (profile pictures etc.)
├── db.sqlite3 # SQLite database for local/dev
├── manage.py # Django management script
└── ...
Defines database models:
Signup: Custom user (student or teacher, with profile info)Quiz: Quiz metadataMCQ: Multiple Choice Questions for quizzesOpenQuestion: Open-ended questions for quizzesQuizTest: A named set of quizzes/tests for a book/classStudentTest: Assigned tests for a class/book/date rangeNotification: System notifications for students (e.g., new test assigned)StudentTestResult: Stores a student's answers/results for a test
Defines serializers (convert model ↔ JSON, validate input):
SignupSerializer,LoginSerializer: Registration/login logicMCQSerializer,OpenQuestionSerializer,QuizSerializer: For questions/quizzesStudentTestSerializer,StudentTestResultSerializer: For tests/resultsNotificationSerializer: For student notifications
Contains API endpoint logic:
- Registration, login, and profile fetching
- Quiz/question/test creation and retrieval
- Assigning tests to classes
- Student test submission and result handling
- Progress, performance, and notification APIs for both roles
Maps URLs to views for the API:
/signup/,/login/,/user-data//quiz/,/book-quiz/,/save-quiz-test//assign-test/,/student/progress/,/student-classes//student/notifications/,/notification/mark-read/<id>//student-averages/,/assigned_subjects/, ...- See file for complete list!
git clone <your-repo-url>
cd Testsystem/backendWindows:
python -m venv venv
venv\Scripts\activateMac/Linux:
python3 -m venv venv
source venv/bin/activateIf you have a requirements.txt:
pip install -r requirements.txt(If missing, install the essentials: pip install django djangorestframework djangorestframework-simplejwt and any other used packages)
python manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverServer will be available at http://127.0.0.1:8000/.
For full details, see
user_auth/urls.py. Here are the most important endpoints:
| Endpoint | Method | Description |
|---|---|---|
/signup/ |
POST | Register a new user |
/login/ |
POST | Log in and get token |
/user-data/ |
GET | Fetch user profile data |
/quiz/ |
POST | Generate quiz/questions from text |
/book-quiz/ |
GET | Fetch MCQs for a specific book/class |
/save-quiz-test/ |
POST | Save a new test |
/assign-test/ |
POST | Assign a test to a class |
/fetch-test/ |
POST | Fetch a specific assigned test |
/submit-test-results/ |
POST | Student submits answers/results |
/get-student-test-result/ |
GET | Fetch student test result |
/student/progress/ |
GET | Student progress per book |
/student-classes/ |
GET | List of all student classes |
/student/notifications/ |
GET | Fetch notifications for a student |
/notification/mark-read/<id>/ |
POST | Mark notification as read |
/assigned_subjects/ |
GET | Get overview of assigned books/subjects |
| ... | (See urls.py for full list) |
- Custom User Auth: Registration/login for student & teacher, JWT/token-based sessions.
- Quiz & Test Management: Auto-generates MCQs/open questions, compiles tests, assigns to classes.
- Notifications: Sends notifications to students for new/updated tests.
- Student Progress: Tracks and reports on student test results and progress.
- Teacher Reports: Average scores and analytics for teacher dashboards.
- Media Handling: Supports user profile pictures.
Of course! Here’s the updated Notes section for PostgreSQL:
- By default, this backend uses PostgreSQL for the database (configured in
settings.py). - Media uploads are stored in
/media/. - To access the Django admin panel:
/admin/(requires superuser).