Skip to content

Latest commit

 

History

62 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VotingSite

Python Version Django Version PostgreSQL Docker License

Django-based voting platform for creating, managing, and voting on polls.

The project includes user accounts, poll categories, social authentication, email verification, and Docker-based deployment.

VotingSite screenshot VotingSite screenshot VotingSite screenshot
image image image

Features

  • Poll creation
  • Voting system
  • Poll categories
  • User profiles
  • Voting history
  • Dark mode
  • Responsive layout
  • Google and GitHub authentication
  • Email verification
  • reCAPTCHA protection
  • Docker Compose setup

Stack

  • Python 3.13
  • Django 6.0
  • PostgreSQL 16
  • Gunicorn
  • Nginx
  • SASS / SCSS
  • JavaScript
  • django-allauth
  • django-recaptcha
  • Docker / Docker Compose

Project Structure

VotingSite
├── backend
│   ├── app
│   ├── polls
│   ├── user
│   ├── main
│   ├── templates
│   ├── static
│   ├── media
│   ├── fixtures
│   ├── Dockerfile
│   ├── entrypoint.sh
│   └── manage.py
├── conf.d
│   └── nginx.conf
├── compose.yml
├── requirements.txt
├── .env
└── README.md

Installation

Docker

Install Docker: https://docs.docker.com/engine/install/

Clone the repository:

git clone https://github.com/kapusta123b/VotingSite.git
cd VotingSite

Edit environment variables:

nano .env

Update Nginx server name:

nano conf.d/nginx.conf

Example:

server_name your_server_ip_or_domain;

Build and start containers:

docker compose up -d --build

Apply migrations:

docker exec voting-web python manage.py migrate

Load demo data ( optional ):

docker exec voting-web python manage.py loaddata fixtures/user/users.json
docker exec voting-web python manage.py loaddata fixtures/polls/polls_Category.json
docker exec voting-web python manage.py loaddata fixtures/polls/polls_Question.json
docker exec voting-web python manage.py loaddata fixtures/polls/polls_Choice.json

Create admin user ( optional ):

docker exec voting-web python manage.py createsuperuser

Manual Installation only for DEV

Use this setup for local development.

Clone the repository:

git clone https://github.com/kapusta123b/VotingSite.git
cd VotingSite

Create virtual environment:

cd backend
python -m venv .venv

Activate virtual environment:

Linux:

source .venv/bin/activate

Windows:

.venv\Scripts\activate

Install dependencies:

pip install -r --no-cache-dir requirements.txt

Install PostgreSQL, create a user and a database, https://www.postgresql.org/download/, and then replace the values ​​in the backend/.env file with your own.

# replace values with your own
DB_NAME=voting_db
DB_USER=voting_user
DB_PASS=voting_pass # user password
DB_HOST=localhost # don't touch
DB_PORT=5432 # don't touch

Apply migrations:

python manage.py migrate # important!

Load demo data ( optional ):

python manage.py loaddata fixtures/user/users.json
python manage.py loaddata fixtures/polls/polls_Category.json
python manage.py loaddata fixtures/polls/polls_Question.json
python manage.py loaddata fixtures/polls/polls_Choice.json

Create admin user:

python manage.py createsuperuser

Run development server:

python manage.py runserver

Site is available at:

http://localhost:8000

Admin panel available at:

http://localhost:8000/admin

Log in as a superuser using the username and password created earlier


Social Authentication

The project supports Google and GitHub authentication through django-allauth.

After deployment, create OAuth applications in Google Cloud Console and GitHub Developer Settings.

Required callback URLs:

http://your_domain/accounts/google/login/callback/
http://your_domain/accounts/github/login/callback/

Then add the providers in Django Admin:

Social Accounts -> Social Applications -> Add

Useful Commands

Start containers:

docker compose compose.yml up -d

Stop containers:

docker compose compose.yml down

Stop containers and remove volumes:

docker compose compose.yml down -v

Rebuild containers:

docker compose compose.yml up -d --build

View logs:

docker compose compose.yml logs -f

Open Django shell:

docker exec votingsite-web-1 python manage.py shell

Open PostgreSQL shell:

docker exec votingsite-db-1 psql -U voting_user -d voting_db

Notes

Before deployment, update:

  • .env
  • Nginx server_name
  • OAuth credentials

Do not commit real secrets or production credentials to the repository.


License

MIT

About

A Django voting platform featuring secure allauth integration, social OAuth, and result tracking

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages