diff --git a/Assignment/HW7 - Mega Lab Travel App/Untitled.rtf b/Assignment/HW7 - Mega Lab Travel App/Untitled.rtf
new file mode 100644
index 0000000..5be5d02
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/Untitled.rtf
@@ -0,0 +1,8 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1504
+{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;}
+{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red255\green255\blue255;}
+{\*\expandedcolortbl;\csgray\c100000;\csgray\c0;\csgray\c100000;}
+\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
+
+\f0\fs22 \cf2 \cb3 \CocoaLigature0 sqlite3 app.db < schema.sql}
diff --git a/Assignment/HW7 - Mega Lab Travel App/__pycache__/config.cpython-35.pyc b/Assignment/HW7 - Mega Lab Travel App/__pycache__/config.cpython-35.pyc
new file mode 100644
index 0000000..584b99f
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/__pycache__/config.cpython-35.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app.db b/Assignment/HW7 - Mega Lab Travel App/app.db
new file mode 100644
index 0000000..5bdf8f9
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app.db differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/__init__.py b/Assignment/HW7 - Mega Lab Travel App/app/__init__.py
new file mode 100755
index 0000000..353d3af
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/__init__.py
@@ -0,0 +1,8 @@
+from flask import Flask
+from flask.ext.sqlalchemy import SQLAlchemy
+
+app = Flask(__name__)
+app.config.from_object('config')
+db = SQLAlchemy(app)
+
+from app import views, models
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/__init__.pyc b/Assignment/HW7 - Mega Lab Travel App/app/__init__.pyc
new file mode 100644
index 0000000..7773f19
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/__init__.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/__init__.cpython-35.pyc b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..b96f483
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/__init__.cpython-35.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/forms.cpython-35.pyc b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/forms.cpython-35.pyc
new file mode 100644
index 0000000..d638a91
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/forms.cpython-35.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/models.cpython-35.pyc b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/models.cpython-35.pyc
new file mode 100644
index 0000000..6f8860d
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/models.cpython-35.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/views.cpython-35.pyc b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/views.cpython-35.pyc
new file mode 100644
index 0000000..be0d30e
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/__pycache__/views.cpython-35.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/forms.py b/Assignment/HW7 - Mega Lab Travel App/app/forms.py
new file mode 100755
index 0000000..85b6016
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/forms.py
@@ -0,0 +1,29 @@
+from flask.ext.wtf import Form
+from wtforms import StringField, SelectField
+from wtforms.validators import DataRequired
+
+
+class TripForm(Form):
+ '''
+ Add trip input form fields
+ '''
+ name_of_trip = StringField('name_of_trip', validators=[DataRequired()])
+ destination = StringField('destination', validators=[DataRequired()])
+ friend2 = SelectField('friend2', validators=[DataRequired()])
+
+
+class SignupForm(Form):
+ '''
+ Add user input form fields
+ '''
+ user_name = StringField('user_name', validators=[DataRequired()])
+ password = StringField('password', validators=[DataRequired()])
+
+
+class LoginForm(Form):
+ '''
+ Login form fields
+ '''
+ user_name = StringField('user_name', validators=[DataRequired()])
+ password = StringField('password', validators=[DataRequired()])
+
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/forms.pyc b/Assignment/HW7 - Mega Lab Travel App/app/forms.pyc
new file mode 100644
index 0000000..669b7b7
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/forms.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/models.py b/Assignment/HW7 - Mega Lab Travel App/app/models.py
new file mode 100755
index 0000000..1490a4a
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/models.py
@@ -0,0 +1,64 @@
+import sqlite3 as sql
+
+
+def create_trip(name_of_trip, destination, friend1, friend2):
+ '''
+ Creates a trip entry to db
+ '''
+ with sql.connect("app.db") as con:
+ cur = con.cursor()
+ cur.execute("PRAGMA foreign_keys=ON;")
+ try:
+ cur.execute(
+ "INSERT INTO trips (trip_name, destination, friend1, friend2) VALUES (?, ?, ?, ?)", (name_of_trip, destination, friend1, friend2))
+ con.commit()
+ except Exception as e:
+ print("Error in inseting trip records: ", e)
+
+
+def create_user(user_name, password):
+ '''
+ Creates a user entry to db
+ '''
+ with sql.connect("app.db") as con:
+ cur = con.cursor()
+ try:
+ cur.execute(
+ "INSERT INTO users (user_name, password) VALUES (?, ?)", (user_name, password))
+ con.commit()
+ except Exception as e:
+ print("Error in inseting user records: ", e)
+
+
+def retrieve_users():
+ '''
+ Retrieves users from db
+ '''
+ with sql.connect("app.db") as con:
+ con.row_factory = sql.Row
+ cur = con.cursor()
+ users = cur.execute("SELECT * FROM users").fetchall()
+ return users
+
+
+def retrieve_trips():
+ '''
+ Retrieves trip details from db
+ '''
+ with sql.connect("app.db") as con:
+ con.row_factory = sql.Row
+ cur = con.cursor()
+ trips = cur.execute(
+ "SELECT * from trips").fetchall()
+ return trips
+
+
+def delete_trip(trip_name):
+ '''
+ Deletes trip details from db
+ '''
+ stmt = "DELETE FROM trips where trip_name = '" + trip_name + "'"
+ with sql.connect("app.db") as con:
+ cur = con.cursor()
+ cur.execute(stmt)
+ con.commit()
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/models.pyc b/Assignment/HW7 - Mega Lab Travel App/app/models.pyc
new file mode 100644
index 0000000..6184eb3
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/models.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/static/main.js b/Assignment/HW7 - Mega Lab Travel App/app/static/main.js
new file mode 100644
index 0000000..363af55
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/static/main.js
@@ -0,0 +1,21 @@
+$(document).ready(function() {
+ $('select').material_select();
+});
+
+$(".delete-row").click(function() {
+ var tripName = $(this).closest('tr').children()[0].innerHTML
+ var trRemove = $(this).closest('tr')
+ $.ajax({
+ type: "POST",
+ url: "/delete_trip",
+ data: JSON.stringify({ "tripName" : tripName }),
+ contentType: "application/json",
+ success: function(response){
+ console.log(response)
+ $(this).closest('tr').remove()
+ trRemove.fadeOut(1000,function(){
+ trRemove.remove();
+ });
+ }
+ });
+});
\ No newline at end of file
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/templates/base.html b/Assignment/HW7 - Mega Lab Travel App/app/templates/base.html
new file mode 100755
index 0000000..30c2460
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/templates/base.html
@@ -0,0 +1,17 @@
+
+
+ {% if title %}
+ {{ title }} - Travel App
+ {% else %}
+ Welcome to IO Lab Travel App
+ {% endif %}
+
+
+
+
+ {% block content %}{% endblock %}
+
+
+
+
+
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/templates/home.html b/Assignment/HW7 - Mega Lab Travel App/app/templates/home.html
new file mode 100755
index 0000000..222c0bd
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/templates/home.html
@@ -0,0 +1,39 @@
+{% extends "base.html" %}
+{% block content %}
+
+
+
Welcome to MegaLab Travel App
+
+
+
+
You have the below trips
+
+
+
+ Trip Name |
+ Destination |
+ Friend 1 |
+ Friend 2 |
+
+
+
+ {% for trip in trips %}
+
+ {{ trip['trip_name']}} |
+ {{ trip['destination']}} |
+ {{ trip['friend1']}} |
+ {{ trip['friend2']}} |
+ |
+
+ {% endfor %}
+
+
+
+
+
+{% endblock %}
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/templates/login.html b/Assignment/HW7 - Mega Lab Travel App/app/templates/login.html
new file mode 100755
index 0000000..3b1ddf0
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/templates/login.html
@@ -0,0 +1,29 @@
+{% extends "base.html" %}
+{% block content %}
+
+{% endblock %}
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/templates/signup.html b/Assignment/HW7 - Mega Lab Travel App/app/templates/signup.html
new file mode 100755
index 0000000..369b29a
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/templates/signup.html
@@ -0,0 +1,26 @@
+{% extends "base.html" %}
+{% block content %}
+
+{% endblock %}
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/templates/trip.html b/Assignment/HW7 - Mega Lab Travel App/app/templates/trip.html
new file mode 100755
index 0000000..a90d9ab
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/templates/trip.html
@@ -0,0 +1,37 @@
+{% extends "base.html" %}
+{% block content %}
+
+
+
+ Logged in as: {{ user }}
+
Logout
+
+
+
Create a Trip
+
+
+
+
+
+
+{% endblock %}
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/views.py b/Assignment/HW7 - Mega Lab Travel App/app/views.py
new file mode 100755
index 0000000..73033ab
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/app/views.py
@@ -0,0 +1,138 @@
+from flask import render_template, redirect, request, session, escape, json
+from app import app, models, db
+from .forms import *
+from .models import *
+
+
+@app.route('/')
+@app.route('/home', methods=['GET', 'POST'])
+def display_trips():
+ '''
+ Displays trips for the logged in user
+ '''
+ current_user = ""
+ if 'username' in session:
+ current_user = escape(session['username'])
+ trips = retrieve_trip_data(current_user)
+ return render_template('home.html', trips=trips, user=current_user)
+ else:
+ return redirect('login')
+
+
+def retrieve_trip_data(current_user):
+ trips = []
+ trip_rows = models.retrieve_trips()
+ for trip_row in trip_rows:
+ if trip_row['friend1'] == current_user or trip_row['friend2'] == current_user:
+ trips.append(trip_row)
+ return trips
+
+
+@app.route('/login', methods=['GET', 'POST'])
+def login():
+ '''
+ Authenticates and logs in user
+ '''
+ login_form = LoginForm()
+ if login_form.validate_on_submit():
+ # Get data from the form
+ user_name = login_form.user_name.data
+ password = login_form.password.data
+ # Authenticate user
+ if authenticate_user(user_name, password):
+ session['username'] = user_name
+ return redirect('home')
+ else:
+ return redirect('login')
+
+ return render_template('login.html', form=login_form)
+
+
+def authenticate_user(user_name, password):
+ '''
+ Retrieves users from db to authenticate attempted login
+ '''
+ user_rows = models.retrieve_users()
+ for user_row in user_rows:
+ if user_row['user_name'] == user_name and user_row['password'] == password:
+ return True
+ return False
+
+
+@app.route('/logout', methods=['GET', 'POST'])
+def logout():
+ session.pop('username')
+ return redirect('login')
+
+
+@app.route('/create_user', methods=['GET', 'POST'])
+def create_user():
+ '''
+ Creates a new user entry in db
+ '''
+ signup_form = SignupForm()
+ if signup_form.validate_on_submit():
+ # Get data from the form
+ user_name = signup_form.user_name.data
+ password = signup_form.password.data
+ # Send data from form to Database
+ models.create_user(user_name, password)
+ return redirect('login')
+
+ return render_template('signup.html', form=signup_form)
+
+
+@app.route('/create_trip', methods=['GET', 'POST'])
+def create_trip():
+ '''
+ Creates a new trip entry in db
+ '''
+ if 'username' in session:
+ current_user = escape(session['username'])
+ trip_form = TripForm()
+ trip_form.friend2.choices = retrieve_users()
+ if trip_form.validate_on_submit():
+ # Get data from the form
+ name_of_trip = trip_form.name_of_trip.data
+ destination = trip_form.destination.data
+ friend2 = trip_form.friend2.data
+
+ # Send data from form to Database
+ models.create_trip(name_of_trip, destination,
+ current_user, friend2)
+ return redirect('home')
+
+ return render_template('trip.html', form=trip_form, user=current_user)
+
+ else:
+ return redirect('login')
+
+
+def retrieve_users():
+ '''
+ Retrieves users from db to display in Friends dropdown in Create User page.
+ Remove currently logged in user from the list
+ '''
+ user_rows = models.retrieve_users()
+ users = []
+ current_user = ""
+ if 'username' in session:
+ current_user = escape(session['username'])
+ for user_row in user_rows:
+ if user_row['user_name'] == current_user:
+ continue
+ users.append(user_row['user_name'])
+
+ return [(user, user) for user in users]
+
+
+@app.route('/delete_trip', methods=['GET', 'POST'])
+def delete_trip():
+ '''
+ Deletes trip row from the db
+ '''
+ print("Invoked!")
+ responseJson = request.get_json(force=True)
+ models.delete_trip(responseJson['tripName'].strip())
+
+ return json.dumps({'status': 'OK'})
diff --git a/Assignment/HW7 - Mega Lab Travel App/app/views.pyc b/Assignment/HW7 - Mega Lab Travel App/app/views.pyc
new file mode 100644
index 0000000..38f8e5c
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/app/views.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/config.py b/Assignment/HW7 - Mega Lab Travel App/config.py
new file mode 100755
index 0000000..bbbb224
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/config.py
@@ -0,0 +1,9 @@
+import os
+basedir = os.path.abspath(os.path.dirname(__file__))
+
+# Will be used for ORM Lab
+# SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
+# SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
+
+WTF_CSRF_ENABLED = True
+SECRET_KEY = 'you-will-never-guess'
diff --git a/Assignment/HW7 - Mega Lab Travel App/config.pyc b/Assignment/HW7 - Mega Lab Travel App/config.pyc
new file mode 100644
index 0000000..59af7fd
Binary files /dev/null and b/Assignment/HW7 - Mega Lab Travel App/config.pyc differ
diff --git a/Assignment/HW7 - Mega Lab Travel App/requirements.txt b/Assignment/HW7 - Mega Lab Travel App/requirements.txt
new file mode 100755
index 0000000..bfbaf81
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/requirements.txt
@@ -0,0 +1,10 @@
+Flask==0.10.1
+Flask-SQLAlchemy==2.1
+Flask-WTF==0.12
+itsdangerous==0.24
+Jinja2==2.8
+MarkupSafe==0.23
+SQLAlchemy==1.0.12
+Werkzeug==0.11.4
+wheel==0.29.0
+WTForms==2.1
diff --git a/Assignment/HW7 - Mega Lab Travel App/run.py b/Assignment/HW7 - Mega Lab Travel App/run.py
new file mode 100755
index 0000000..5d2f714
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/run.py
@@ -0,0 +1,2 @@
+from app import app
+app.run(debug=True, host="0.0.0.0", port=8081)
diff --git a/Assignment/HW7 - Mega Lab Travel App/schema.sql b/Assignment/HW7 - Mega Lab Travel App/schema.sql
new file mode 100644
index 0000000..88e68d8
--- /dev/null
+++ b/Assignment/HW7 - Mega Lab Travel App/schema.sql
@@ -0,0 +1,15 @@
+-- Insert code to create Database Schema
+-- This will create your .db database file for use
+DROP TABLE IF EXISTS users;
+CREATE TABLE users (
+ user_name TEXT PRIMARY KEY,
+ password TEXT
+);
+
+DROP TABLE IF EXISTS trips;
+CREATE TABLE trips (
+ trip_name TEXT PRIMARY KEY,
+ destination TEXT,
+ friend1 TEXT REFERENCES users(user_name),
+ friend2 TEXT REFERENCES users(user_name)
+);
\ No newline at end of file
diff --git a/Labs/Lab11-ORMS/orm_tutorial.zip b/Labs/Lab11-ORMS/orm_tutorial.zip
new file mode 100644
index 0000000..47b035c
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial.zip differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/__pycache__/config.cpython-35.pyc b/Labs/Lab11-ORMS/orm_tutorial/__pycache__/config.cpython-35.pyc
new file mode 100644
index 0000000..8fa6558
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/__pycache__/config.cpython-35.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app.db b/Labs/Lab11-ORMS/orm_tutorial/app.db
new file mode 100755
index 0000000..932098e
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app.db differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/__init__.py b/Labs/Lab11-ORMS/orm_tutorial/app/__init__.py
new file mode 100755
index 0000000..353d3af
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/app/__init__.py
@@ -0,0 +1,8 @@
+from flask import Flask
+from flask.ext.sqlalchemy import SQLAlchemy
+
+app = Flask(__name__)
+app.config.from_object('config')
+db = SQLAlchemy(app)
+
+from app import views, models
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/__init__.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/__init__.pyc
new file mode 100644
index 0000000..7773f19
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/__init__.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/__init__.cpython-35.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..ee30df3
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/__init__.cpython-35.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/forms.cpython-35.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/forms.cpython-35.pyc
new file mode 100644
index 0000000..1a36f5c
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/forms.cpython-35.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/models.cpython-35.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/models.cpython-35.pyc
new file mode 100644
index 0000000..e5d1b5f
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/models.cpython-35.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/views.cpython-35.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/views.cpython-35.pyc
new file mode 100644
index 0000000..0b1bb94
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/__pycache__/views.cpython-35.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/forms.py b/Labs/Lab11-ORMS/orm_tutorial/app/forms.py
new file mode 100755
index 0000000..5724699
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/app/forms.py
@@ -0,0 +1,9 @@
+from flask.ext.wtf import Form
+from wtforms import StringField, IntegerField
+from flask_wtf.html5 import EmailField
+from wtforms.validators import DataRequired
+
+class CustomerForm(Form):
+ company = StringField('company', validators=[DataRequired()])
+ email = EmailField('email', validators=[DataRequired()])
+ # Add additional Address fields here
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/forms.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/forms.pyc
new file mode 100644
index 0000000..669b7b7
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/forms.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/models.py b/Labs/Lab11-ORMS/orm_tutorial/app/models.py
new file mode 100755
index 0000000..65bc1e0
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/app/models.py
@@ -0,0 +1,12 @@
+from app import db
+
+# Your Customer Database code should go here
+
+
+class Customer(db.Model):
+ id = db.Column(db.Integer, primary_key=True)
+ company = db.Column(db.String(120), unique=False)
+ email = db.Column(db.String(120))
+
+ def __repr__(self):
+ return '' % self.id
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/models.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/models.pyc
new file mode 100644
index 0000000..0aae0da
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/models.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/templates/base.html b/Labs/Lab11-ORMS/orm_tutorial/app/templates/base.html
new file mode 100755
index 0000000..db51f24
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/app/templates/base.html
@@ -0,0 +1,14 @@
+
+
+ {% if title %}
+ {{ title }} - ACME
+ {% else %}
+ Welcome to ACME Aircraft Parts
+ {% endif %}
+
+
+
+
+ {% block content %}{% endblock %}
+
+
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/templates/customer.html b/Labs/Lab11-ORMS/orm_tutorial/app/templates/customer.html
new file mode 100755
index 0000000..d7b457a
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/app/templates/customer.html
@@ -0,0 +1,30 @@
+{% extends "base.html" %}
+{% block content %}
+
+
+
+
Add Customer to Our Database
+
+
+
+{% endblock %}
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/templates/home.html b/Labs/Lab11-ORMS/orm_tutorial/app/templates/home.html
new file mode 100755
index 0000000..6b447ec
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/app/templates/home.html
@@ -0,0 +1,31 @@
+{% extends "base.html" %}
+{% block content %}
+
+
+
Welcome to ACME Aircraft Parts
+
+
+
+
These are all of our awesome customers:
+
+
+
+ Company |
+ Email |
+
+
+ {% for customer in customers %}
+
+
+ {{ customer.company }} |
+ {{ customer.email }} |
+
+ {% endfor %}
+
+
+
+
+{% endblock %}
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/views.py b/Labs/Lab11-ORMS/orm_tutorial/app/views.py
new file mode 100755
index 0000000..3fd1bf9
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/app/views.py
@@ -0,0 +1,30 @@
+from flask import render_template, redirect, request
+from app import app, models, db
+from .forms import CustomerForm
+
+
+@app.route('/')
+def index():
+ return redirect('/create_customer')
+
+
+@app.route('/create_customer', methods=['GET', 'POST'])
+def create_customer():
+ form = CustomerForm()
+ # Capture form data and send to database
+ if form.validate_on_submit():
+ customer = models.Customer(
+ company=form.company.data,
+ email=form.email.data)
+ db.session.add(customer)
+ db.session.commit()
+ return redirect('/customers')
+ return render_template('customer.html', form=form)
+
+
+@app.route('/customers')
+def display_customer():
+ # Fetch customer data from database
+ customers = models.Customer.query.all()
+ return render_template('home.html',
+ customers=customers)
diff --git a/Labs/Lab11-ORMS/orm_tutorial/app/views.pyc b/Labs/Lab11-ORMS/orm_tutorial/app/views.pyc
new file mode 100644
index 0000000..e27a6bd
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/app/views.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/config.py b/Labs/Lab11-ORMS/orm_tutorial/config.py
new file mode 100755
index 0000000..a995426
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/config.py
@@ -0,0 +1,8 @@
+import os
+basedir = os.path.abspath(os.path.dirname(__file__))
+
+SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
+SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
+
+WTF_CSRF_ENABLED = True
+SECRET_KEY = 'you-will-never-guess'
diff --git a/Labs/Lab11-ORMS/orm_tutorial/config.pyc b/Labs/Lab11-ORMS/orm_tutorial/config.pyc
new file mode 100644
index 0000000..59af7fd
Binary files /dev/null and b/Labs/Lab11-ORMS/orm_tutorial/config.pyc differ
diff --git a/Labs/Lab11-ORMS/orm_tutorial/readme.md b/Labs/Lab11-ORMS/orm_tutorial/readme.md
new file mode 100755
index 0000000..f5a8d70
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/readme.md
@@ -0,0 +1,21 @@
+# Models Lab/Homework
+The goal for this lab is to get you comfortable translating your database models into actual code. We will be using [ORMs](https://en.wikipedia.org/wiki/Object-relational_mapping) to help us. The particular ORM that we will be using is SQLAlchemy (the flask implementation is called [Flask-SQLAlchemy](http://flask-sqlalchemy.pocoo.org/2.1/)).
+
+We'll walk through the example together in class which will give you an idea of how this all works together. Your goal for this lab and homework is to create the remaining models, forms, and routes to complete v2 of the exercise from last week.
+
+This means that you must:
+* Create the following tables and the appropriate relationships:
+ * customer
+ * address
+ * order
+ * Remember to run update_database.py whenever you make changes to any models.
+ * This will update the database with your changes. However, **it will delete any data in the database**.
+* Create the forms, templates, routes, etc necessary to input this data into the database.
+* Create a view to showcase the data into your database (see the current implementation of "home.html" for example)
+
+The following documentation will help answer any questions you may have.
+
+## Helpful Documentation
+- [Flask-SQLAlchemy](http://flask-sqlalchemy.pocoo.org/2.1/)
+- [Accessing SQLite3 Command Shell](https://www.sqlite.org/cli.html)
+- [Flask-WTF](https://flask-wtf.readthedocs.org/en/latest/) (flask plugin for creating forms easily)
diff --git a/Labs/Lab11-ORMS/orm_tutorial/requirements.txt b/Labs/Lab11-ORMS/orm_tutorial/requirements.txt
new file mode 100755
index 0000000..bfbaf81
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/requirements.txt
@@ -0,0 +1,10 @@
+Flask==0.10.1
+Flask-SQLAlchemy==2.1
+Flask-WTF==0.12
+itsdangerous==0.24
+Jinja2==2.8
+MarkupSafe==0.23
+SQLAlchemy==1.0.12
+Werkzeug==0.11.4
+wheel==0.29.0
+WTForms==2.1
diff --git a/Labs/Lab11-ORMS/orm_tutorial/run.py b/Labs/Lab11-ORMS/orm_tutorial/run.py
new file mode 100755
index 0000000..5d2f714
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/run.py
@@ -0,0 +1,2 @@
+from app import app
+app.run(debug=True, host="0.0.0.0", port=8081)
diff --git a/Labs/Lab11-ORMS/orm_tutorial/update_database.py b/Labs/Lab11-ORMS/orm_tutorial/update_database.py
new file mode 100755
index 0000000..b15e4da
--- /dev/null
+++ b/Labs/Lab11-ORMS/orm_tutorial/update_database.py
@@ -0,0 +1,3 @@
+from app import db
+db.drop_all()
+db.create_all()
diff --git a/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/__init__.cpython-35.pyc b/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..11d8241
Binary files /dev/null and b/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/__init__.cpython-35.pyc differ
diff --git a/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/model.cpython-35.pyc b/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/model.cpython-35.pyc
new file mode 100644
index 0000000..33f6fe1
Binary files /dev/null and b/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/model.cpython-35.pyc differ
diff --git a/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/views.cpython-35.pyc b/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/views.cpython-35.pyc
new file mode 100644
index 0000000..57610bb
Binary files /dev/null and b/Labs/MongoDB_Lab/lab_mongo/app/__pycache__/views.cpython-35.pyc differ
diff --git a/Labs/MongoDB_Lab/lab_mongo/app/model.py b/Labs/MongoDB_Lab/lab_mongo/app/model.py
index d8f07c2..6d4bd8f 100644
--- a/Labs/MongoDB_Lab/lab_mongo/app/model.py
+++ b/Labs/MongoDB_Lab/lab_mongo/app/model.py
@@ -1,10 +1,25 @@
import pymongo
-#gets you the handler on the mongo client
+# gets you the handler on the mongo client
+client = pymongo.MongoClient()
+# choose the data base
+db = client.Surveys
+# choose the collection
+collection = db.usersurveys
+# example code
-#choose the data base
-#choose the collection
+def insertRecords(username, email, surveyResponse):
+ collection.insert({"username": username,
+ "email": email,
+ "color": surveyResponse['color'],
+ "food": surveyResponse['food'],
+ "vacation": surveyResponse['vacation'],
+ "fe-before": surveyResponse['fe-before'],
+ "fe-after": surveyResponse['fe-after']
+ })
-#example code
+
+def display():
+ return collection
diff --git a/Labs/MongoDB_Lab/lab_mongo/app/views.py b/Labs/MongoDB_Lab/lab_mongo/app/views.py
index 9b45207..8883be0 100644
--- a/Labs/MongoDB_Lab/lab_mongo/app/views.py
+++ b/Labs/MongoDB_Lab/lab_mongo/app/views.py
@@ -1,64 +1,70 @@
-from app import myapp,model
+from app import myapp, model
from flask import request, render_template, session, redirect, url_for, escape
import os
myapp.secret_key = os.urandom(24)
+
@myapp.route('/')
@myapp.route('/index')
def index():
- username = ''
- if 'username' in session:
- username = escape(session['username'])
- return render_template('survey.html', name=username)
- else:
- return render_template('login.html')
+ username = ''
+ if 'username' in session:
+ username = escape(session['username'])
+ return render_template('survey.html', name=username)
+ else:
+ return render_template('login.html')
+
@myapp.route('/login', methods=['GET', 'POST'])
def login():
- if request.method=='POST':
- session['username'] = request.form['username']
- session['email'] = request.form['email']
- return redirect(url_for('index'))
+ if request.method == 'POST':
+ session['username'] = request.form['username']
+ session['email'] = request.form['email']
+ return redirect(url_for('index'))
+
@myapp.route('/logout')
def logout():
- session.pop('username', None)
- session.pop('email', None)
- return redirect(url_for('index'))
+ session.pop('username', None)
+ session.pop('email', None)
+ return redirect(url_for('index'))
+
@myapp.route('/aggregate')
def newpage():
- if 'username' in session:
- username = escape(session['username'])
- else:
- username = 'Guest'
- #Fetch Data to calculate the average
+ if 'username' in session:
+ username = escape(session['username'])
+ else:
+ username = 'Guest'
+ # Fetch Data to calculate the average
- #calculate score
+ # calculate score
+
+ return render_template('aggregate.html', name=username, score_before=avg_score_before, score_after=avg_score_after, count=total_responses)
- return render_template('aggregate.html',name=username, score_before=avg_score_before, score_after=avg_score_after, count=total_responses)
@myapp.route('/submit-survey', methods=['GET', 'POST'])
def submitSurvey():
- username = ''
- email = ''
- if 'username' in session:
- username = escape(session['username'])
- email = escape(session['email'])
- surveyResponse = {}
- surveyResponse['color'] = request.form.get('color')
- surveyResponse['food'] = request.form.get('food')
- surveyResponse['vacation'] = request.form.get('vacation')
- surveyResponse['fe-before'] = request.form.get('feBefore')
- surveyResponse['fe-after'] = request.form.get('feAfter')
- #new fields for comments and focus
- #insert code here to send surveyresponse into your mongoDB
-
- return render_template('results.html', name=username, email=email, surveyResponse=surveyResponse)
- else:
- return render_template('login.html')
+ username = ''
+ email = ''
+ if 'username' in session:
+ username = escape(session['username'])
+ email = escape(session['email'])
+ surveyResponse = {}
+ surveyResponse['color'] = request.form.get('color')
+ surveyResponse['food'] = request.form.get('food')
+ surveyResponse['vacation'] = request.form.get('vacation')
+ surveyResponse['fe-before'] = request.form.get('feBefore')
+ surveyResponse['fe-after'] = request.form.get('feAfter')
+ # new fields for comments and focus
+ model.insertRecords(username, email, surveyResponse)
+
+ return render_template('results.html', name=username, email=email, surveyResponse=surveyResponse)
+ else:
+ return render_template('login.html')
+
@myapp.errorhandler(404)
def page_not_found(error):
- return render_template('page_not_found.html'), 404
+ return render_template('page_not_found.html'), 404
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/Untitled.rtf b/Labs/lab-SQL/lab-SQL/Lab-SQLite/Untitled.rtf
new file mode 100644
index 0000000..5be5d02
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/Untitled.rtf
@@ -0,0 +1,8 @@
+{\rtf1\ansi\ansicpg1252\cocoartf1504
+{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;}
+{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red255\green255\blue255;}
+{\*\expandedcolortbl;\csgray\c100000;\csgray\c0;\csgray\c100000;}
+\margl1440\margr1440\vieww10800\viewh8400\viewkind0
+\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0
+
+\f0\fs22 \cf2 \cb3 \CocoaLigature0 sqlite3 app.db < schema.sql}
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/__pycache__/config.cpython-35.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/__pycache__/config.cpython-35.pyc
new file mode 100644
index 0000000..5689024
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/__pycache__/config.cpython-35.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app.db b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app.db
new file mode 100644
index 0000000..d1f1fbe
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app.db differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__init__.py b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__init__.py
new file mode 100755
index 0000000..353d3af
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__init__.py
@@ -0,0 +1,8 @@
+from flask import Flask
+from flask.ext.sqlalchemy import SQLAlchemy
+
+app = Flask(__name__)
+app.config.from_object('config')
+db = SQLAlchemy(app)
+
+from app import views, models
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__init__.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__init__.pyc
new file mode 100644
index 0000000..7773f19
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__init__.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/__init__.cpython-35.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/__init__.cpython-35.pyc
new file mode 100644
index 0000000..e373d42
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/__init__.cpython-35.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/forms.cpython-35.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/forms.cpython-35.pyc
new file mode 100644
index 0000000..19edfb1
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/forms.cpython-35.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/models.cpython-35.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/models.cpython-35.pyc
new file mode 100644
index 0000000..db2556a
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/models.cpython-35.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/views.cpython-35.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/views.cpython-35.pyc
new file mode 100644
index 0000000..a0b5aa2
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/__pycache__/views.cpython-35.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/forms.py b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/forms.py
new file mode 100755
index 0000000..a0d42b1
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/forms.py
@@ -0,0 +1,9 @@
+from flask.ext.wtf import Form
+from wtforms import StringField, IntegerField
+from flask_wtf.html5 import EmailField
+from wtforms.validators import DataRequired
+
+class CustomerForm(Form):
+ company = StringField('company', validators=[DataRequired()])
+ email = EmailField('email', validators=[DataRequired()])
+
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/forms.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/forms.pyc
new file mode 100644
index 0000000..669b7b7
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/forms.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/models.py b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/models.py
new file mode 100755
index 0000000..2d28700
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/models.py
@@ -0,0 +1,19 @@
+import sqlite3 as sql
+
+
+def insert_customer(company, email):
+ # SQL statement to insert into database goes here
+ with sql.connect("app.db") as con:
+ cur = con.cursor()
+ cur.execute(
+ "INSERT INTO customers (company, email) VALUES (?, ?)", (company, email))
+ con.commit()
+
+
+def retrieve_customers():
+ # SQL statement to query database goes here
+ with sql.connect("app.db") as con:
+ con.row_factory = sql.Row
+ cur = con.cursor()
+ result = cur.execute("select * from customers").fetchall()
+ return result
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/models.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/models.pyc
new file mode 100644
index 0000000..6184eb3
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/models.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/base.html b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/base.html
new file mode 100755
index 0000000..db51f24
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/base.html
@@ -0,0 +1,14 @@
+
+
+ {% if title %}
+ {{ title }} - ACME
+ {% else %}
+ Welcome to ACME Aircraft Parts
+ {% endif %}
+
+
+
+
+ {% block content %}{% endblock %}
+
+
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/customer.html b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/customer.html
new file mode 100755
index 0000000..36c49b4
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/customer.html
@@ -0,0 +1,29 @@
+{% extends "base.html" %}
+{% block content %}
+
+
+
+
Add Customer to Our Database
+
+
+
+{% endblock %}
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/home.html b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/home.html
new file mode 100755
index 0000000..8f06a97
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/templates/home.html
@@ -0,0 +1,32 @@
+{% extends "base.html" %}
+{% block content %}
+
+
+
Welcome to ACME Aircraft Parts
+
+
+
+
These are all of our awesome customers:
+
+
+
+ Company |
+ Email |
+
+
+
+
+ {% for customer in customers %}
+
+ {{ customer['company']}} |
+ {{ customer['email']}} |
+
+ {% endfor %}
+
+
+
+
+
+{% endblock %}
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/views.py b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/views.py
new file mode 100755
index 0000000..da7cde1
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/views.py
@@ -0,0 +1,30 @@
+from flask import render_template, redirect, request
+from app import app, models, db
+from .forms import CustomerForm
+# Access the models file to use SQL functions
+
+
+@app.route('/')
+def index():
+ return redirect('/create_customer')
+
+
+@app.route('/create_customer', methods=['GET', 'POST'])
+def create_customer():
+ form = CustomerForm()
+ if form.validate_on_submit():
+ # Get data from the form
+ # Send data from form to Database
+ company = form.company.data
+ email = form.email.data
+ models.insert_customer(company, email)
+ return redirect('/customers')
+ return render_template('customer.html', form=form)
+
+
+@app.route('/customers')
+def display_customer():
+ # Retreive data from database to display
+ customers = models.retrieve_customers()
+ return render_template('home.html',
+ customers=customers)
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/views.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/views.pyc
new file mode 100644
index 0000000..38f8e5c
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/app/views.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/config.py b/Labs/lab-SQL/lab-SQL/Lab-SQLite/config.py
new file mode 100755
index 0000000..bbbb224
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/config.py
@@ -0,0 +1,9 @@
+import os
+basedir = os.path.abspath(os.path.dirname(__file__))
+
+# Will be used for ORM Lab
+# SQLALCHEMY_DATABASE_URI = 'sqlite:///' + os.path.join(basedir, 'app.db')
+# SQLALCHEMY_MIGRATE_REPO = os.path.join(basedir, 'db_repository')
+
+WTF_CSRF_ENABLED = True
+SECRET_KEY = 'you-will-never-guess'
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/config.pyc b/Labs/lab-SQL/lab-SQL/Lab-SQLite/config.pyc
new file mode 100644
index 0000000..59af7fd
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Lab-SQLite/config.pyc differ
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/requirements.txt b/Labs/lab-SQL/lab-SQL/Lab-SQLite/requirements.txt
new file mode 100755
index 0000000..bfbaf81
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/requirements.txt
@@ -0,0 +1,10 @@
+Flask==0.10.1
+Flask-SQLAlchemy==2.1
+Flask-WTF==0.12
+itsdangerous==0.24
+Jinja2==2.8
+MarkupSafe==0.23
+SQLAlchemy==1.0.12
+Werkzeug==0.11.4
+wheel==0.29.0
+WTForms==2.1
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/run.py b/Labs/lab-SQL/lab-SQL/Lab-SQLite/run.py
new file mode 100755
index 0000000..5d2f714
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/run.py
@@ -0,0 +1,2 @@
+from app import app
+app.run(debug=True, host="0.0.0.0", port=8081)
diff --git a/Labs/lab-SQL/lab-SQL/Lab-SQLite/schema.sql b/Labs/lab-SQL/lab-SQL/Lab-SQLite/schema.sql
new file mode 100644
index 0000000..aa10b84
--- /dev/null
+++ b/Labs/lab-SQL/lab-SQL/Lab-SQLite/schema.sql
@@ -0,0 +1,8 @@
+-- Insert code to create Database Schema
+-- This will create your .db database file for use
+drop table if exists customers;
+create table customers (
+ customer_id integer primary key,
+ company text not null,
+ email text not null
+);
diff --git a/Labs/lab-SQL/lab-SQL/Pokemon.db b/Labs/lab-SQL/lab-SQL/Pokemon.db
new file mode 100644
index 0000000..0dd44fa
Binary files /dev/null and b/Labs/lab-SQL/lab-SQL/Pokemon.db differ