Web Programming with Python and HTML
In this project I built a book review website. I used Goodreads API to pull in the ratings from a broader audience. I also used OpenLibrary to pull in book covers to the website.
- Python 3
- HTML
- CSS
- Flask Framework
- Jinja2
- SQLAlchemy
In the website:
- Users are able to register and create a new account
- Users are able to log in to the website using their username and password
- Logged in users can search for books, leave reviews for books, and read reviews made by other people
In order to run this application, you need the following dependencies:
- Python 3
- Flask
- SQLAlchemy
- PostgreSQL database
- For this application I have used Heroku database. Navigate to https://www.heroku.com/, and create an account if you don’t already have one.
- You are free to set up PostgreSQL database on your local computer.
- Goodreads API
- You need to create a Goodreads account if you don't already have one. Navigate to https://www.goodreads.com/api/keys, and apply for an API key.
You also need to install a couple of other python packages. Those can be found and installed from requirements.txt file.
There are two python scripts provided under utils/ directory. Using these two scripts you can:
database.py: Creates all the databases needed to run the application. It creates the following tables:- Users : Stores user information such as name, username, password, and email address.
- Books : Stores book information such as book title, author, isbn number, and year of publish.
- Reviews : Stores all the reviews given by users to books in our database.
- Message : Stores all the messages sent to us from the Contact page.
import.py: Imports all the data frombooks.csvto the databasebooks. This is the database users use later to query books from.
export FLASK_APP=application.pyexport FLASK_DEBUG=1export DATABASE_URL=HEROKU_DATABASE_LINK(Do this if you use Heroku as your PostgreSQL database)
In you terminal run flask run, which will run the application.py set on your environment. You can visit the app by visiting: http://localhost:5000/
/
/account
/search (For logged in users)
book/<isbn> (For logged in users)
An error is given to users in the following situations:
- If users enter invalid username and password
- If users do not use unique username or email address
- If users leave username, password, or email fields empty upon registration
- If no result is found for user's book search
- If users want to submit more than one review for a book








