Git Product home page Git Product logo

book-ratings's Introduction

Book Ratings

File: import.py

functions

  • create_tables

    • Input : SCHEMA.sql ( for basic table structure )
    • Output : Generate table present in SCHEMA.sql
  • get_books_data ( generator function)

    • Input : books.csv ( for list of isbn required for API request)
    • Output : yields information about books fetched from GOODREADS API
  • insert_books

    • Input : Uses book data yielded by get_books_data
    • Output : Inserts book data in Database at heroku

File: application.py

View_Functions

  • index(page=1) :
    • Path = [ '/' , '/page/int:page' ]
    • Returns index.html page.
  • search(page=1) :
    • Path = [ '/search' , '/search/page/int:page' ]
    • Returns search.html page or Redirects to login view function.
  • register() :
    • Path = '/register'
    • Returns forms.html page or Redirects to login view function.
  • login() :
    • Path = '/login'
    • Returns forms.html page.
  • logout() :
    • Path = '/logout'
    • Redirects to index view function.
  • book(isbn) :
    • Path = '/book/string:isbn'
    • Returns book.html page.
  • post_reviews() :
    • Path = '/post'
    • Redirects book view function.
  • book_info(isbn) :
    • Path = '/api/string:isbn'
    • Returns JSON response.

Other Functions

  • load_loggedin_user() - loads logged in user if any. ( called before every request )
  • login_required(view) - protects routes which require authorization. ( called before any protected view ) Protected Views - [ 'search', 'post_review' ]

Dir: Templates

  • macros.html - Contains macros used as module only.

    • card(book, flag=True) : Used in book.html
    • form(title, hrefs, msg) : Used in forms.html
    • paginateBooks(endpoint, books, page, item=None) : Used in search.html and index.html
  • layout.html - Contains basic layout used as base for all pages.

  • index.html - Home page

  • forms.html - Register and Login pages

  • search.html - Search result page

  • book.html - Book page

  • error.html - Error page

Dir: Static

  • master.css - Contains styles for all pages.

Other Files

  • books.csv : Contains basic information about 5000 books used to get data about books in import.py.
  • requirements.txt : Contains requirements of project meant o be installed by pip install -r requirements.txt.
  • runtime.txt : Contains python runtime required for deployment to heroku.
  • Procfile : Contains init info for deployment to heroku.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.