Skip to content
Registered users can maintain lists of items using CRUD functionality. Authorization is completed via OAuth 2.0 providers, Google and Facebook.
HTML Python CSS Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
vagrant
.gitignore
LICENSE
README.md

README.md

Item Catalog


What is it?

Allows users to register and login using OAuth2 providers Google & Facebook so they can create lists of items in distinct categories. All categories and items are viewable but they can only be added to, edited, or deleted by the user who created them.

The web server is written in Python using Flask framework and the database uses SQLite.

Installation

  1. Download and install VirtualBox
  2. Download and install Vagrant. Be sure to grant network permissions.
  3. If using Windows you will also need to install an app in order to ssh to the Vagrant virual machine. I would recomment Git.
  4. Visit the Google API Console and configure OAuth 2.0 credentials
    • Create a project for the Item Catalog
    • Select Credentials from the menu on the left.
    • Create an OAuth Client ID and configure the consent screen
    • Select Web application as the application type
    • Set the Authorized JavaScript origins as needed. For local testing use, http://localhost:8000
    • Record your Client ID and Client secret in file client_secrets.json
    • Additional info can be found in this guide
  5. Visit the Facebook Developers page and configure OAuth 2.0 credentials
    • Add a New App and enter a Display Name and select a Category
    • On the left, select Settings from the menu
    • Set the Site URL as needed. For local testing use, http://localhost:8000
    • Record your App ID and App Secret in file fb_client_secrets.json
    • Additional info can be found in this guide

Development

Modify the site as needed. All HTML files are located in the templates directory. Styling can be changed using the CSS file style.css in the /static/css folder.

A blank catalog.db database can be created by running this command from a terminal in the project folder:

$ python database_setup.py

The application's server code can be modified in file application.py.

Running Locally

Ensure database, catalog.db exists in the application directory. If not, run database_setup:

$ python database_setup.py

The application's Python server can be started from within the Vagrant virtual machine. To start the Vagrant VM, first run this command from a Terminal within the application's directory.

$ vagrant up

Once the VM is up and running connect to it using this command:

$ vagrant ssh

This should result in the following prompt in the VM:

The shared directory is located at /vagrant
To access your shared files: cd /vagrant
Last login: Mon Jan 16 13:22:01 2017 from 10.0.0.1
vagrant@vagrant-ubuntu-trusty-32:~$ 

To start the Flask web server you will need to first navigate to the app's directory using this command:

vagrant@vagrant-ubuntu-trusty-32:~$ cd /vagrant/catalog

Then start application:

vagrant@vagrant-ubuntu-trusty-32:/vagrant/catalog$ python application.py

Which should result in the server starting and listening on port 8000. The server can be killed by pressing CTRL+C.

 * Running on http://0.0.0.0:8000/
 * Restarting with reloader

The site will then be avialible at http://localhost:8000/. JSON representations of the database are availible at:

If you wish to use a different port change it on line 688 of application.py.

	app.run(host="0.0.0.0", port=8000)

Todos

  • Add images to items with CRUD functionality

License

MIT

You can’t perform that action at this time.