Skip to content

These files make up a RESTful web application using Flask which was used to create a Sports Jersey catalog for Udacity.

Notifications You must be signed in to change notification settings

christopherjeon/item-catalog-project

Repository files navigation

Item Catalog Project

This .zip file contains various files that create a RESTful web application using the Python framework Flask along with implementing third-party OAuth authentication.

For this project, I have created a sports jersey catalog. Users who have logged into their Google accounts have the ability to create new jerseys and to edit and delete existing ones using CRUD operations.

Prerequisites

Getting Started

Download the .zip file, which has:

  • catalog_project.py
  • catalog_database.py
  • lotsofsports.py
  • client_secrets.json
  • 'templates' folder which contains HTML files
  • 'static' folder which contains the CSS file, catalog-stylesheet.css

Open each file to examine its contents and comments in the code.

Running The Script

Firing up the VM:

  • Run vagrant up
  • Run vagrant ssh
  • Run cd /vagrant

To load the data, use the following commands in the virtual machine in this order:

  • python catalog_database.py
  • python lotsofsports.py
  • python catalog_project.py

After these steps, you may now run: http://localhost:8000/ to access the catalog.

catalog_project.py

This file contains many functions that utilize Flask in order to create the backend of this website.

App Routes have been created for the purpose of structuring specific pages of this website, such as the list of sports and jerseys, as well as links to adding, editing, and deleting specific jerseys.

In addition, the gconnect and the gdisconnect functions serve to allow third-party authenication using Google accounts. This code and related content has been used from Udacity's solution codes in Lesson 11, "Creating A Google Sign-In" and Lesson 17, "Securing Your APIs".

catalog_database.py

This python file contains three classes:

  • User
  • Sport
  • Jersey

These classes serve as the backbone of this application and the bridge between catalog_project.py and lotsofsports.py.

The User class has four attributes:

  • id - Provided by Flask
  • name
  • email
  • picture

The Sport class has two attributes:

  • id - Provided by Flask
  • name

The Jersey class has eight attributes:

  • id - Provided by Flask
  • name
  • description
  • price
  • user_id
  • user - Establishes relationship with the User class
  • sport_id
  • sport - Establishes relationship with the Sport class

lotsofsports.py

This file is essentially the database of this web application. There are instances created from the User, Sports, and Jersey classes which will make up the initial items in the catalog.

Built With

  • Atom - Text editor used to create report_tool.py and README.md
  • Vagrant - A tool for building and managing virtual machine environments in a single workflow.
  • VirtualBox- VirtualBox is a general-purpose full virtualizer for x86 hardware, targeted at server, desktop and embedded use.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Authors

  • Chris Jeon

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

Acknowledgments

  • Lorenzo Brown from Udacity
  • Abhishek Ghosh from Udacity
  • Trish Whetzel from Udacity

About

These files make up a RESTful web application using Flask which was used to create a Sports Jersey catalog for Udacity.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published