Skip to content

MaiNorapong/django-polls

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

django-polls

An application created following Django's tutorial with some modifications.

Requirements

This project requires:

  • Python 3.6 or newer
  • Django 2.1.2 or newer
  • Other Python packages as in requirements.txt

How to run

Setup

From the directory root, install required packages using the following command:

$ pip install -r requirements.txt

Create .env text file in the project directory root and configure settings value for Django.

Create the database using the following command:

$ python manage.py migrate

(Optional) Create sample poll data using the following command:

$ python manage.py loaddata sample_poll_data

You're all set now!

Note: A required configuration value for .env is SECRET_KEY.
A useful tool to generate one: https://www.miniwebtool.com/django-secret-key-generator/.

Example:

# A line in `project_directory/.env`
SECRET_KEY=c07(7b9676lfo8l6xwe#mn(ua%%bpt4c0bh)9jcr0p+v4fs*8k

Running

Start the server using the following command:

$ python manage.py runserver

The server should be up at localhost on port 8000.
Go to the polls app at polls/ and the admin site at admin/.

If you choose to use the sample data, an account with admin privileges will have already been created for you:

Username: admin
Password: password

If for some reason port 8000 is not available, simply specify another port like so:

$ python manage.py runserver 8001

You can use any port that's available, not just 8001 like shown.

Note: To use the admin site, you must have an account that can login to it.
See the Django documentation on how to create one.

Progress

  • Part 1: Requests and responses
  • Part 2: Models and the admin site
  • Part 3: Views and templates
  • Part 4: Forms and generic views
  • Part 5: Testing
  • Part 6: Static files
  • Part 7: Customizing the admin site

FAQ

1. Unrecognized command

If you see error messages like 'python' is not recognized as an internal or external command, operable program or batch file. or Command not found: pip, you might not have Python and pip correctly installed and/or included in your path. Such problems are not in the scope of this README.

Copy your error message and search it on Google (or other search engines) and there should be plenty of answers in sites like Stack Overflow.

About

A project created following Django's tutorial

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published