Skip to content

acivux/ItemCatalog

Repository files navigation

WineCave

WineCave helps you track your wine tasting journey. Add and rate your own wine selection or that of the other users of the site.

Requirements

  • Python 2.7.6 or later
  • This has not been tested on any Apple devices

Download

Installation

The easiest way to get all the required Python packages installed is by using pip. On a Linux machine, please make sure to use a user with the appropriate rights.

Flask

pip install Flask

Flask-Restless

pip install Flask-Restless

Flask-Restless handles the database JSON API front-end.

Marshmallow

pip install marshmallow

Marshmallow handles custom database query conversions to JSON

Flask-Uploads

pip Flask-Uploads

Flask-Uploads handles the images as uploaded by users.

Setup

Your user

To access all the features of the site, you will need to set up user account. For convenience, a file called testing_user_sample.py has been provided. Fill the required fields and rename the file to testing_user_sample.py This file will be called in by populate_db.py, explained below.

Database

populate_db.py will create the database and set it up with test data. Run it by executing python populate_db.py. If successful, a database file called catalog.db will be created in the root folder.

Application

Vagrant

To run the application from inside Vagrant, change the host IP address to 0.0.0.0 inside application.py: app.run(host='0.0.0.0', port=5000)

Non-Vagrant

To run the application from outside Vagrant, change the host IP address to 127.0.0.1 inside application.py: app.run(host='127.0.0.1', port=5000)

The application is accessed from http://localhost:5000 in the browser. Anything else will prevent the 3rd party authentication from succeeding.

3rd Party Authentication

WinCave uses Google and Facebook for user authentication. The app registration data can be found in auth_api as JSON files.

Administration

An admin user can manage the following wine type attributes:

  • Colors
  • Calories
  • Alcohol by Volume
  • Temperature
  • Glass types

To mark a user as an administrator, set the admin field in the user's database record to True. No UI has been implemented for this. Normally the test user will be set as administrator when populate_db.py is executed.

Page API

All application pages (except the user view page) that present a data view has an equivalent JSON implementation. To access the JSON data, append ".json" to the url.

For example:

http://localhost:5000/view.json

Database API

A JSON API is implemented through Flask-Restless on the database level. Only GET requests are valid. Some additional features, like paging, is implemented.

Please read the Flask-Restless documentation for further information.

Endpoints available:

  • winebrand
  • winetype
  • review
  • color
  • calories
  • abv
  • temperature
  • glass

For a complete paged listing, use the url http://localhost:5000/api/<endpoint>. To reach a specific item, use http://localhost:5000/api/<endpoint>/<item_id>

Example

We will use the color endpoint as an example.

List all the colors

Use the url http://localhost:5000/api/color. This will list the first page of results. To retrieve the second page, use the url http://localhost:5000/api/color?page=2

List all a specific color

To find the color with id=2: http://localhost:5000/api/color/2

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published