Giter Club home page Giter Club logo

polls-application's Introduction

Polls Application

Django poll application is a polling app.

About Project

In this poll app project where several polls(Question) are there and you are supposed to vote for them and see the poll results. I have created a model name Poll(Question) and a poll has a question and three options(Choice).Each options is associated with a question of poll.

Features

  • Create Poll
  • Show all poll list
  • Vote for each poll
  • View poll results
  • Apply pagination (i.e Each page contains only three poll(Questions))

Tech Stack

  • Python, Django,Html, CSS, Bootstrap

Output

Acknowledgements/Prerequisites

Some Basic Commands

Initial setup to build Django Project

  • First we need to create a virtual environment.Using a virtual environment avoids installing Django into a global python environment and we will have exact control over the libraries used in an application.

    • Step-1:- Create a project folder on file system like 'Project-django' and open inside VS code.
    • Step-2:- Install django in Separate environment.
  • We can create virtual environment two ways.

  • First way (Open CMD or Terminal)

    1. Install virtual environment wrapper : pip install virtualenvwrapper-win
    2. Create a new virtual environment : mkvirtualenv Env_Name Example : mkvirtualenv poll_env
    3. To activate virtual environment : workon Env_Name Example : workon poll_env
    4. Install Django : pip install django
    • How to setup virtual environment for Django project
    • Using this, virtual environment is install in your default working directory(C Drive).In Envs folder virtual environment(Env_Name) is present.
    • Note : - In terminal virtual environment not seen.In CMD virtual environment see after activate it.To deactivate virtual environment simply type deactivate and to delete virtual environement ,type rmvirtualenv Env_Name and Uninstall django,type pip uninstall django
  • Another way to create virtual environment (Open terminal or CMD)

    1. Create a new virtual environment: python -m venv Env_Name
    2. To activate virtual environment: Env_Name\Scripts\activate.bat But on Unix or MacOS: source Env_Name/bin/activate
    3. Install Django : pip install django
    • How to setup virtual environment for Django project
    • Using this way, virtual environment is install in your current directory.
    • Note : - In terminal virtual environment not seen.In CMD virtual environment see after activate it.To deactivate virtual environment simply type deactivate and to delete virtual environement ,type rmdir Env_Name /s and Uninstall django,type pip uninstall django

After Initial setup

  1. Activate virtual environment : workon Env_Name
  2. Create Django Project : django-admin startproject PROJECT_NAME
  3. Create Django Application : python manage.py startapp APPLICATION_NAME
  4. Install your application in settings.py file.
  5. Run the sever : python manage.py runserver
  6. Open website in browser at http://localhost:8000 or admin at http://localhost:8000/admin
  7. Quit the server : ctrl+c
  • Whenever you edit your model fields (adding a new one, changing an existing one or altering any of the arguments it takes) then you should always run migrations. python manage.py makemigrations <app> : Create the migrations (generate the SQL commands).
  • python manage.py migrate : Run the migrations (execute the SQL commands).
  • To create super user, type : python manage.py createsuperuser

polls-application's People

Contributors

pawankumar1310 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.