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.
- Django Framework
- Virtual Environmet
- Virtual Environment setup
This site helps in setting up the Virtual Environment
python -m venv <envname>
- For Django
pip install django
- 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
- Install all the necessary packages
- Setup the Virtual Environment
- Run the following commands in the Terminal of the project folder
python manage.py makemigrations
python manage.py migrate --run-syncdb
- Create a User account to login to the admin page using the following command
python manage.py createsuperuser
- The project is ready to run on the server. To run it on the server, use the command:
python manage.py runserver
The default app created during the project creation. Contains important files like settings.py and urls.py
To create pollsapp:
django-admin startproject pollsapp
custom app that handles the core logic of the project.
- Shows the Polls questions, respective choices
- Submitting votes
- Displaying the votes
django-admin startapp <appname>
- Question - Stores the questions
- Choice - Stores the choices for the respective question and track the votes
This is not Required
app that handles the home page of Polls App