Git Product home page Git Product logo

fswd-item-catalog's Introduction

Item catalog project

This is a sample project for Udacity's "Programming Foundations" course, and the Full Stack Web Dev nano-degree.

In this project, I've created a Catalog app, in a very generic and basic way. The intent is not to have a production ready application, but to demonstrate some of the core concepts of authentication, access control, and CRUD operations on a database.

Getting Started

You'll need to have Python installed on your computer. Python 2.7 is the version this application is developed on.

I suggest using pipenv to create a python environment and the directions I give will assume you are using this.

Also, this app uses secrets stored in two json files. There are examples of these, file saved with this project, but should be replaced with your own.

The first file, client_secrets.json, requires a Google OAuth API setup. See this Google documentation to get setup and get your "client_secrets.json" file.

The next file is just a custom secrets.json file. The only info stored in it is the secret key passed to the main flask app instance on first run. You can just remove the .example from the end of the suplied secrets.json.example file. If using in production, the value of "SUPER_SECRET_KEY" whould need to be kept secret.

One you have these json files ready, you can run the app.

Usage

  1. Download and unzip the files in this zip file, or clone with git clone [email protected]:beaukinstler/fswd-item-catalog.git

  2. cd into the 'fswd-item-catalog' folder.

  3. If you haven't installed pip on your machine, please do so.

  4. If you haven't installed pipenv, type

     pip install pipenv
    
  5. If you haven't yet created the pipenv, type:

     pipenv --python 2.7
    
  6. Then, use the Piplock file to install the dependencies bu running:

     pipenv install
    

    NOTE: If you don't want to use pipenv, and you wish to do this manually, read the Pipfile and install the python dependencies listed

  7. Now you should be close to ready. By default, this app runs on http://localhost:5000. If you wish to change the port, or have a conflict, change the port at the end of the main_app.py file

  8. Run the app, using this command:

     pipenv run python main_app.py
    
  9. Open a web browser and type in http://localhost:5000, and be sure to change 5000 if you customized the port.

Logging in for the first time

IMPORTANT: The first time you visit the /login url, the application will create an "admin" account if one is not found in the database. When it does, it sets the password to password. You should first log in as admin and change the password.

When you navigate the /login page, you'll be asked authenticate, either with Google, or a username and password.

After you setup the admin user, you can create another user using the "Create User" form.

Creating users using OAuth

Another way to create a user is buy authenticating with OAuth, and specifically at this time, Google. The application will create a user in the database if no user matches the email address of your google account.

JSON end points

There are a number of JSON endpoints available. After logging into the application, you can view the list by selecting the JSON menu item.

fswd-item-catalog's People

Contributors

beaukinstler avatar

Watchers

 avatar

fswd-item-catalog's Issues

new jwt process not catching exceptions properly

The code that checks for user or token expects None if the token doesn't exist. However, it's throwing and exception.

user_id = User.verify_auth_token(usernameOrToken)

f69232f

the function in the db_setup.py User class isn't reaching the default response with a user id if there's no good token. Instead of catching, ExpiredSignatureError and InvalidSignatureError and allowing other exceptions, it is now throwing errors on any other exception

oauth backend and code needs redoing.

TODO:  update this section, after getting oauth setup again

The next file is just a custom _secrets.json_ file. The only info stored in it is the secret key passed to the main flask `app` instance on first run. You can just remove the `.example` from the end of the suplied `secrets.json.example` file. If using in production, the value of "SUPER_SECRET_KEY" whould need to be kept secret.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.