This web app accesses a database of categorised items, allowing the public to browse the catalog, and allowing authorised users to create, update and delete items and categories. I've created this program as part of the Full Stack Web Developer Nanodegree.
-
Download, clone or fork this repository to an appropriate location on your server or virtual machine.
-
Ensure you have the required software dependencies:
-
Python 3
-
PostgreSQL
-
python-slugify
(e.g.,pip3 install python-slugify
)
-
-
Create or download a
google_client_secret.json
file in the project directory containing OAuth credentials for the app. If I haven't supplied you with my credentials for the app, then you need to create your own via the Google Developer Console as follows:-
Authorized origins should include
http://localhost:5000
(or modify if not running locally) -
Authorized redirect URIs should include
http://localhost:5000/postmessage
-
If you create your own credentials, also update the app ID in
login.html
-
-
Create the database:
psql -d catalog
-
Add sample data to the database - from the project directory, run
python3 populate_database.py
. -
Run the app using
python3 application.py
. -
Load the app locally at
http://localhost:5000
.
There are three API calls available to retrieve data in JSON format:
-
/api/categories
returns a list of all categories -
/api/categories/<category_slug>
returns all items in the specified category -
/api/categories/<category_slug>/items/<item_slug>
returns the specified item