/pollsapp

Demo Django

Primary LanguagePython

PollsApp

A simple demo project to undersatnd the basics of the Django Framework. It deals with creating a simple app "polls" to collect the votes of different questions with respective choices.

Requirements

  • Django Framework
  • Virtual Environmet

Installation

  • Virtual Environment setup

This site helps in setting up the Virtual Environment python -m venv <envname>

  • For Django

pip install django

Project Setup

  1. Download and unzip this entire repository from GitHub, either interactively, or by entering the following in your Terminal.
wget https://github.com/srinivas175/pollsapp/archive/master.zip
unzip master.zip
rm master.zip
cd pollsapp

Note: In case of error saying 'wget' not recognized, follow this link for installation and usage of wget

  1. Install all the necessary packages
  2. Setup the Virtual Environment
  3. Run the following commands in the Terminal of the project folder
python manage.py makemigrations
python manage.py migrate --run-syncdb
  1. Create a User account to login to the admin page using the following command
python manage.py createsuperuser
  1. The project is ready to run on the server. To run it on the server, use the command:
python manage.py runserver

Apps

pollsapp

The default app created during the project creation. Contains important files like settings.py and urls.py

To create pollsapp:

django-admin startproject pollsapp

polls

custom app that handles the core logic of the project.

Features

  • Shows the Polls questions, respective choices
  • Submitting votes
  • Displaying the votes

To create polls or any custom app:

django-admin startapp <appname>

Models

  • Question - Stores the questions
  • Choice - Stores the choices for the respective question and track the votes

dashboard

This is not Required

app that handles the home page of Polls App