A full-stack Flask web application for conducting code debugging competitions — similar to HackerRank debugging contests.
https://code-debugger-4jkz.onrender.com/
- Participant registration (name, college, register number)
- Multi-language support (Python, C — admin can add more)
- Question-by-question exam flow with no back navigation
- Countdown timer per question (green → yellow → red)
- 5-attempt limit with visual pip indicators
- Score calculation: base score (100) + time bonus (up to 40) − wrong-attempt penalty (10 each)
- Code comparison (whitespace-insensitive, case-sensitive)
- Admin dashboard — manage languages, problems, view participants, submissions, leaderboard
- Excel export (pandas + openpyxl)
- Security JS: disables right-click, DevTools, copy/paste, F12, refresh, back navigation
- Fullscreen enforcement with auto-logout on exit
code_debugger/
├── app.py # App factory + DB init
├── config.py # Config class (secrets, DB URI)
├── models.py # SQLAlchemy models
├── routes/
│ ├── auth.py # Registration + logout
│ ├── admin.py # Admin panel + CRUD + export
│ └── exam.py # Exam flow + submission logic
├── templates/
│ ├── base.html
│ ├── login.html
│ ├── register.html
│ ├── admin_dashboard.html
│ ├── add_problem.html
│ ├── language_select.html
│ ├── exam.html
│ └── complete.html
├── static/
│ ├── css/style.css
│ └── js/
│ ├── exam.js
│ └── security.js
├── utils/
│ ├── scoring.py
│ └── excel_export.py
├── requirements.txt
└── README.md
# Windows
python -m venv venv
venv\Scripts\activate
# macOS / Linux
python -m venv venv
source venv/bin/activatepip install -r requirements.txtpython app.pyThe database (debug_event.db) is created automatically on first run.
Python and C languages are seeded automatically.
Visit: http://127.0.0.1:5000
| Field | Value |
|---|---|
| URL | /admin/login |
| Username | Admin |
| Password | admin123 |
- Login as Admin → Dashboard
- Click Problems tab → Add Problem
- Fill in:
- Language, Question Number, Time Limit
- Problem Name
- Error Code (shown to participant)
- Correct Code (used for comparison — hidden from participants)
- Expected Output (shown on correct answer)
base_score = 100
time_bonus = (remaining_time / time_limit) × 40
penalty = wrong_attempts × 10
final_score = max(0, base_score + time_bonus − penalty)
git init
git add .
git commit -m "Initial commit"
git remote add origin <your-github-repo-url>
git push -u origin main- Go to https://render.com → New → Web Service
- Connect your GitHub repo
- Fill in:
| Setting | Value |
|---|---|
| Environment | Python |
| Build Command | pip install -r requirements.txt |
| Start Command | gunicorn app:app |
| Branch | main |
| Key | Value |
|---|---|
| SECRET_KEY | your-random-secret-here |
Click Create Web Service — Render will build and deploy.
Note: Render's free tier uses ephemeral storage, so the SQLite DB resets on redeploy. For a persistent database on Render, consider upgrading to a paid tier or using an external database like PostgreSQL (via Render's managed DB).
| Feature | Implemented |
|---|---|
| Right-click disabled | ✅ |
| Copy/paste disabled | ✅ |
| F12 disabled | ✅ |
| Ctrl+U disabled | ✅ |
| Ctrl+R / F5 disabled | ✅ |
| Back navigation blocked | ✅ |
| Fullscreen enforced | ✅ |
| Auto-logout on FS exit | ✅ |
| Code not executed (text compare only) | ✅ |