MagnetonBora / sample

Fork this and send back a pull request

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Description

This is a fork of unisport sample task. A data benchmark can be found here.

Preparation of the application

In order to prepare the application to be able to launch you have to do the following steps.

  • First clone this repository.
  • Create virtual environment mkvirtualenv sample
  • Run pip install -r requirements.txt
  • Run python setup.py develop
  • Optionally you can run tests py.test
  • Finally, you can start the service ./start.sh

IMPORTANT: please note you need to have sqlite3 installed on your system.

Data location

By default the products you create or edit via web-page are strored in data/products.db. By default in data folder you can find the SQLite databse with data from benchmark. If you'd like to use fresh db you need to remove data/products.db file and run python createdb.py to create a database schema. If you'd like to fill fresh db with benchmark data go to examples folder and run python migration.py to migrate entries from data.json to data/products.db file.

Available endpoints

The following endpoints are available now.

/products/ Returns the first 10 objects ordered with the cheapest first.

/products/kids/ Returns the products where kids=1 ordered with the cheapest first

/products/?page=2 Returns correspondent page of products. Each page has 10 items.

/products/id/ Returns the individual product.

About

Fork this and send back a pull request


Languages

Language:CSS 37.2%Language:HTML 28.3%Language:Python 27.8%Language:JavaScript 6.6%Language:Shell 0.1%