A complete, production-ready Vote Pro system built with Django 4.2+ and MySQL. This system provides a secure and transparent platform for managing elections, candidates, and voting processes.
- Secure Registration & Login: Django-backed authentication.
- Voter Dashboard: View ongoing and upcoming elections.
- One-Vote Constraint: System prevents multiple votes per election (database-level enforcement).
- Live Results: View winners and vote breakdowns after an election finishes.
- Search: Find elections by title or description.
- Election Management: Create, Edit, and monitor elections (Upcoming, Running, Finished).
- Candidate Management: Add candidates with bios and images to specific elections.
- Voter Control: View all registered voters and block/unblock accounts.
- Audit Logs: Simple background logging of every vote cast.
- Real-time Results: Immediate winner determination based on vote counts.
| Home Page | Registration Page |
|---|---|
![]() |
![]() |
| Voter Dashboard | Election List |
|---|---|
![]() |
![]() |
| Admin Panel | Example View |
|---|---|
![]() |
![]() |
- Backend: Django
- Frontend: Bootstrap 5, FontAwesome, Django Templates
- Database: MySQL (with SQLite fallback)
- Environment: python-dotenv for configuration
Directory structure:
└── nafiul-afk-vote-pro/
├── requirements.txt
└── backend/
├── manage.py
├── requirements.txt
├── accounts/
│ ├── __init__.py
│ ├── admin.py
│ ├── forms.py
│ ├── models.py
│ ├── urls.py
│ └── migrations/
│ ├── 0001_initial.py
│ └── __init__.py
├── core/
│ ├── __init__.py
│ ├── asgi.py
│ ├── urls.py
│ └── wsgi.py
├── elections/
│ ├── __init__.py
│ ├── admin.py
│ ├── forms.py
│ ├── urls.py
│ └── migrations/
│ └── __init__.py
├── templates/
│ ├── accounts/
│ │ ├── login.html
│ │ └── register.html
│ └── elections/
│ ├── candidate_form.html
│ └── election_form.html
└── voting/
├── __init__.py
├── admin.py
├── urls.py
└── migrations/
└── __init__.py
- Python 3.8+
- MySQL Server (optional, defaults to SQLite)
- mysqlclient dependencies (e.g., libmysqlclient-dev on Linux)
# Clone the repository
git clone https://github.com/nafiul-afk/vote-pro.git
cd vote-pro
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r backend/requirements.txt
# Setup configuration
cp .env.example .envNote: If using MySQL, update .env with your database credentials.
cd backend
python manage.py migrate
python manage.py createsuperuserTo populate the database with example elections and candidates:
python setup_sample_data.pypython manage.py runserverVisit http://127.0.0.1:8000/
- Security: Password hashing, atomic transactions, and CSRF protection.
- Integrity: Unique vote constraints to prevent double-voting.
- Flexibility: Support for Running, Upcoming, and Finished elections.
- Automation: Easy sample data setup for testing.
- Password Hashing: PBKDF2 (Django default).
- Atomic Transactions: Ensures vote integrity during high-concurrency casting.
- Access Control: LoginRequiredMixin and user_passes_test protect sensitive views.
- DB Integrity: unique_together constraint on (voter, election) prevents double-voting.
This project is licensed under the MIT License.





