Skip to content

Latest commit

 

History

History
97 lines (66 loc) · 2.47 KB

README.md

File metadata and controls

97 lines (66 loc) · 2.47 KB

DjangoPoll

Static Badge Static Badge Static Badge Coverage Status

About Project

DjangoPoll is an API for conducting polls. Implemented the ability to register a user, view all polls, the ability to answer questions with the output of the next question depending on the answer to the previous one (Building questions in the form of a tree using the django-mptt library), as well as viewing poll statistics and each question (implemented using pure SQL without Django ORM).

Features

Quickstart

First, clone project

git clone https://github.com/Niolum/DjangoPoll.git

Further, set up the virtual environment and the main dependencies from the requirements.txt

python -m venv venv
source venv/bin/activate 
pip install -r requirements.txt

Then, create .env file. set environment variables and create database.

Example .env:

DATABASE_NAME=db_name
DATABASE_USER=username
DATABASE_PASSWORD=password
DATABASE_HOST=localhost
DATABASE_PORT=5432

DEBUG=False
SECRET_KEY='some_secret_key'

Before starting, you need to execute several commands:

python manage.py migrate

Run application:

python manage.py runserver

Open your web browser and navigate to http://localhost:8000/api/v1/docs/ to access your Swagger.

For start in docker-compose create .env_docker:

POSTGRES_USER=username
POSTGRES_PASSWORD=password
POSTGRES_DB=db_name

DATABASE_NAME=db_name
DATABASE_USER=username
DATABASE_PASSWORD=password
DATABASE_HOST='db'
DATABASE_PORT=5431

DEBUG=False
SECRET_KEY='some_secret_key'

To start the project, use the following command:

docker-compose up -d

Run test

To run all the tests of a project, simply run the pytest command:

pytest