Submission for Udacity's Full Stack Web Developer Nanodegree Program's Item Catalog Project. The project tests the developer's skill in applying authorisation, servers and CRUD knowledge using a Flask web application.
An application that provides a list of items within a variety of categories as well as provide a user registration and authentication system. Registered users will have the ability to post, edit and delete their own items.
Follow these steps to run the project. You must use a terminal (command line interface):
-
Install VirtualBox
You can download it from virtualbox.org, here. Install the platform package for your operating system.
-
Install Vagrant
Vagrant is the software that configures the VM and lets you share files between your host computer and the VM's filesystem. Download it from vagrantup.com. Install the version for your operating system.
-
Download the VM Configuration
Fork and clone the Fullstack Nanodegree VM Repo. Open up your terminal and then
cdinto the directory. Inside, you will find another directory called vagrant. Change directory to the vagrant directory. -
Start the virtual machine
From inside the vagrant directory run the following command:
vagrant up
After that is completed run the following command to login to the virtual machine:
vagrant ssh
This project uses Google Accounts to implement authentication, a hybrid OAuth approach . Therfore you must create a client ID and client secret that can be used in the application.
- Go to the Google API Console
- From the project drop-down, select an existing project, or create a new one by selecting Create a new project.
- In the sidebar under "APIs & Services", select Credentials, then select the OAuth consent screen tab. Choose an Email Address, specify a Product Name, and press Save.
- In the Credentials tab, select the Create credentials drop-down list, and choose OAuth client ID. Under Application type, select Web application.
- After creating your credentials, copy the client ID and download the client_secret.json file by going to the Credentials page.
# Replace 'YOUR_CLIENT_ID_HERE' with the copied client ID in login.html line 19
auth2 = gapi.auth2.init({
client_id: 'YOUR_CLIENT_ID_HERE.apps.googleusercontent.com'
});- Finally save client_secrets.json inside the
catalogdirectory
-
Download the code
Clone this repository to the vagrant directory. Go into the directory and then run:
python database_setup.py
This will set up an empty MySQL database by the name itemcatalog.db. To populate the database with some dummy data run:
python populate_db.py
After populating the database you can bring up the server and visit the web application on your browser.
python server.py
This should open a Flask server at localhost:5000