Udacity Project FSND Course.
This project is a RESTful web application utilizing the Flask framework which accesses a SQL database that populates categories and their items. OAuth2 provides authentication for further CRUD functionality on the application. Currently OAuth2 is implemented for Google Accounts.
This project has one main Python module projectwithusers.py which runs the Flask application. A SQL database is created using the database_setupwithusers.py module and you can populate the database with test data using databasewithusers.py.
The Flask application uses stored HTML templates in the tempaltes folder to build the front-end of the application. CSS/JS/Images are stored in the static directory.
- Python
- HTML
- CSS
- OAuth
- Flask Framework
There are some dependancies and a few instructions on how to run the application. Seperate instructions are provided to get GConnect working also.
- Install Vagrant & VirtualBox
- Clone the Udacity Vagrantfile
- Go to Vagrant directory and either clone this repo or download and place zip here
- Launch the Vagrant VM (
vagrant up) - Log into Vagrant VM (
vagrant ssh) - Navigate to
cd/vagrantas instructed in terminal - The app imports requests which is not on this vm. Run sudo pip install requests
- Setup application database
project/database_setupwithusers.py - *Insert fake data
project/databasewithusers.py - Run application using
project/projectwithusers.py - Access the application locally using http://localhost:5000
*Optional step(s)
To get the Google login working there are a few additional steps:
- Go to Google Dev Console
- Sign up or Login if prompted
- Go to Credentials
- Select Create Crendentials > OAuth Client ID
- Select Web application
- Enter name 'Item-Catalog'
- Authorized JavaScript origins = 'http://localhost:5000'
- Authorized redirect URIs = 'http://localhost:5000/login' && 'http://localhost:5000/gconnect'
- Select Create
- Copy the Client ID and paste it into the
data-clientidin itemmenu1.html, itemenu2.html,itemdesc.html - On the Dev Console Select Download JSON
- Rename JSON file to client_secrets.json
- Place JSON file in item-catalog directory that you cloned from here
- Run application using
project /projectwithusers.py
The following are open to the public:
Catalog JSON: /catalog/JSON
- Displays the whole catalog. Categories and all items.
Category Items JSON: /category/<int:category_id>/menu/<int:item_id>/JSON
- Displays items for a specific category