An automated online coding assignment platform built with Django & Django REST Framework
Teachers create programming assignments with test cases. Students submit Python solutions and get instant, automated grading with detailed feedback.
- About
- Live Demo
- Features
- Tech Stack
- Screenshots
- Project Structure
- Getting Started
- Environment Variables
- API Reference
- Workflow
- Roadmap
- Contributing
- License
- Author
CodeGrader is a full-stack coding assignment platform that automates the process of setting, submitting, and grading programming assignments. Teachers can create assignments with multiple hidden/visible test cases, deadlines, and marks. Students submit Python code that is automatically executed and evaluated, receiving instant per-test-case feedback and a leaderboard ranking.
The project exposes both a server-rendered web UI and a complete REST API (with JWT authentication), making it usable as a standalone web app or as a backend for a separate frontend/mobile client.
The project is deployed and publicly accessible.
π App URL: https://codegrader.up.railway.app
- Secure teacher login with role-based authorization
- Create coding assignments with descriptions, deadlines, and marks
- Add multiple test cases (input/expected output) per assignment
- View all assignments and track submissions
- Registration and login
- Browse available assignments
- Submit Python solutions through the web UI or API
- Automatic code execution against all test cases
- Instant grading with per-test-case pass/fail feedback
- Personal dashboard with submission statistics
- Total submissions count
- Best score achieved
- Recent submission history
- Ranking by highest score
- Live score updates as students submit
- Django's built-in authentication system
- Role-based access control (Teacher / Student)
- JWT authentication for the REST API
- Session authentication for the DRF Browsable API
A complete, browsable REST API built with Django REST Framework, supporting registration, login, assignment management, and submission/grading β all consumable by external clients (e.g. a React/Vue SPA or mobile app).
| Layer | Technology |
|---|---|
| Backend | Python, Django, Django REST Framework |
| Database | PostgreSQL (production), SQLite (local dev) |
| Auth | JWT (djangorestframework-simplejwt), Django Session Auth |
| Frontend | Django Templates, HTML, CSS, JavaScript |
| Styling | Tailwind CSS, DaisyUI |
| Deployment | Deployed to production (see Live Demo) |
| Assignment Dashboard | Submission Result | Submission History |
|---|---|---|
| Assignment Dashboard | Submission Result | Submission History |
codegrader/
β
βββ accounts/ # User auth, registration, roles (teacher/student)
βββ assignments/ # Assignment & test case models, views
βββ submissions/ # Submission handling, code evaluation, grading
βββ templates/ # Django HTML templates
βββ theme/ # Tailwind CSS / DaisyUI theme config
βββ manage.py
βββ requirements.txt
- Python 3.10+
- PostgreSQL (for production-like setup) or SQLite (quick local testing)
pipandvenv
# 1. Clone the repository
git clone https://github.com/Unnati-29/CodeGrader.git
cd CodeGrader
# 2. Create and activate a virtual environment
python -m venv venv
# Windows
venv\Scripts\activate
# macOS / Linux
source venv/bin/activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Configure environment variables
cp .env.example .env # then fill in your values (see below)
# 5. Apply migrations
python manage.py migrate
# 6. Create an admin/superuser account
python manage.py createsuperuser
# 7. Run the development server
python manage.py runserverOpen your browser at:
http://127.0.0.1:8000/
Create a .env file in the project root (do not commit this file):
SECRET_KEY=your-django-secret-key
DEBUG=False
ALLOWED_HOSTS=localhost,127.0.0.1,your-domain.com
DATABASE_URL=postgres://user:password@host:port/dbname
JWT_ACCESS_TOKEN_LIFETIME_MINUTES=60
JWT_REFRESH_TOKEN_LIFETIME_DAYS=7Adjust variable names to match however
settings.pyis currently configured (e.g. if usingdjango-environorpython-decouple).
Base URL: /api/
| Endpoint | Method | Description | Auth Required |
|---|---|---|---|
/api/auth/register/ |
POST | Register a new user (student/teacher) | No |
/api/auth/login/ |
POST | Log in, returns JWT tokens | No |
/api/auth/profile/ |
GET | Get logged-in user's profile | Yes |
/api/assignments/ |
GET | List all assignments | Yes |
/api/assignments/ |
POST | Create a new assignment (teacher only) | Yes |
/api/submissions/ |
GET | List submissions (own / all for teacher) | Yes |
/api/submissions/ |
POST | Submit code for grading | Yes |
Authentication: Include the JWT access token in requests:
Authorization: Bearer <access_token>
The API is also explorable via the DRF Browsable API in a web browser, and supports Session Authentication for that purpose.
Teacher
- Register / Login
- Create an assignment
- Add test cases, set deadline & marks
- Students are notified / can view the assignment
Student
- Register / Login
- Browse available assignments
- Submit Python code
- Code is automatically executed and evaluated
- Receive score & detailed per-test-case feedback
- Leaderboard updates in real time
Planned enhancements for future releases:
- Containerized code execution sandbox (Docker) for safe/isolated code runs
- Redis + Celery for asynchronous grading
- Multi-language support (C++, Java, in addition to Python)
- Plagiarism detection
- Email notifications (new assignments, results)
- Assignment-level analytics for teachers
- Submission status states (Pending / Running / Accepted / Wrong Answer)
- Dedicated teacher dashboard with class-wide insights
- Student progress tracking over time
Current Version: v1.1
- β Deployed to production
- β PostgreSQL as the production database
- β Template-based web application
- β REST API (DRF)
- β JWT authentication
- β Role-based access control
- β Automatic code evaluation
- β Dashboard & leaderboard
- β Assignment management
In Progress / Upcoming
- π§ Docker-based code execution sandbox
- π§ Multi-language compiler support
- π§ Advanced analytics
Contributions are welcome! To contribute:
- Fork the repository
- Create a feature branch (
git checkout -b feature/your-feature) - Commit your changes (
git commit -m "Add: your feature") - Push to the branch (
git push origin feature/your-feature) - Open a Pull Request
Please open an issue first to discuss significant changes.
Unnati Raj Mechanical Engineering Undergraduate, NIT Silchar Aspiring Software Development Engineer | Django Β· DRF Β· DSA Β· Web Development
If you found this project useful, consider giving it a β on GitHub!