https://github.com/j-raghav/book-ratings
Book rating site made using Flask and Postgresql database and data from Goodreads API
https://github.com/j-raghav/book-ratings
bootstrap4 flask flask-application flask-session flask-sqlalchemy jinja2-templates login-system pagination-support postgresql search-interface
Last synced: 3 months ago
JSON representation
Book rating site made using Flask and Postgresql database and data from Goodreads API
- Host: GitHub
- URL: https://github.com/j-raghav/book-ratings
- Owner: J-Raghav
- Created: 2020-06-10T09:26:47.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T10:10:20.000Z (over 2 years ago)
- Last Synced: 2025-01-09T20:42:26.255Z (4 months ago)
- Topics: bootstrap4, flask, flask-application, flask-session, flask-sqlalchemy, jinja2-templates, login-system, pagination-support, postgresql, search-interface
- Language: Python
- Size: 139 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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/'_ ]
- Returns _index.html_ page.
- **search(page=1)** :
- Path = [ _'/search'_ , _'/search/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/'_
- Returns _book.html_ page.
- **post\_reviews()** :
- Path = _'/post'_
- Redirects _book_ view function.
- **book\_info(isbn)** :
- Path = _'/api/'_
- 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.