A full-featured, login-protected multiple-choice quiz application built with Django and MySQL/SQLite. Users can select subjects like Python, Java, or Front-End Technologies, choose difficulty levels (Beginner, Intermediate, Expert), take exams, and get instant results with answer feedback.
- 🔐 User registration with email OTP verification
- 📧 Email sending using Gmail SMTP (via Django)
- 📚 Quiz Subjects: Python, Java, Front-End Technologies
- 🎯 Levels: Beginner, Intermediate, Expert
- ✅ Real-time result evaluation with answer feedback
- 📊 Score summary with correct/incorrect answers
- 🗃️ MySQL (or SQLite for deployment) with 180+ questions
- 🌐 Deployment-ready on platforms like Render, Railway, etc.
- Framework: Django 5.x
- Database: MySQL (development), SQLite (deployment optional)
- Frontend: HTML, Bootstrap 4
- Auth: Django’s built-in authentication
- Email: Gmail SMTP for OTP
- Deployment: Can be deployed with Gunicorn + Nginx or cloud platforms
git clone https://github.com/6jp9/SimpleDjangoProjects.git
cd SimpleDjangoProjects/Quiz_AppMake sure Django and the database client are installed:
pip install django
pip install mysqlclient # or use pymysql if preferred💡 If you want to use a virtual environment, that's even better (but optional).
-
Create a MySQL database:
CREATE DATABASE quiz_app_db CHARACTER SET UTF8;
-
Update
settings.py:DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'quiz_app_db', 'USER': 'root', 'PASSWORD': 'your_password', 'HOST': 'localhost', 'PORT': '3306', } }
-
Load your data:
python manage.py makemigrations python manage.py migrate python manage.py loaddata py_questions.json
In settings.py, switch to:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}Then run:
python manage.py migrate
python manage.py loaddata py_questions.jsonIn settings.py & viwes.py, add your Gmail SMTP settings:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST_USER = 'your_email@gmail.com' #Add From mail
EMAIL_HOST_PASSWORD = 'your_app_password' # Generated from Google Account > Security > App Passwordsdef signup(request):
if request.method == 'POST':
-------------------------
-------------------------
send_mail(
subject='Quiz App Email Verification',
message = f"Hello {form.cleaned_data['username']},\nYour OTP for verification is {otp}.",
from_email='<your_email>.com', #Add From mail
recipient_list=[form.cleaned_data['email']],
fail_silently=False,
----------------------
⚠️ Make sure to enable 2-Step Verification in your Google account and create an App Password.
python manage.py runserverThen visit: http://127.0.0.1:8000/
- User signs up with email and password
- OTP is sent to email via Gmail SMTP
- User verifies OTP to complete registration
- After login, user selects subject and level
- Quiz is loaded and responses are submitted
- App calculates score and shows results with answers
Quiz_App/
├── testapp/
│ ├── migrations/
│ ├── templates/
│ │ └── testapp/
│ │ ├── signup.html
│ │ ├── otpverify.html
│ │ ├── exam.html
│ │ └── result.html
│ ├── views.py
│ ├── models.py
│ └── forms.py
├── py_questions.json
├── db.sqlite3
├── manage.py
└── TestProject/
├── settings.py
└── urls.py
Create superuser:
python manage.py createsuperuserAccess admin panel at: http://127.0.0.1:8000/admin/
- Pagination for questions
- Timer for exams
- PDF certificate generation
- Export results via email
- Dashboard for progress tracking
- Make sure to keep your
.jsonfixtures clean and UTF-8 encoded - Always validate OTP and sanitize user inputs
- You can disable
fail_silently=Falsein production
For queries or feedback:
📧 Email: jayaprakash.peddi619@gmail.com
GitHub: https://github.com/6jp9
🚧 Built with 💙 using Django and caffeine.