diff --git a/Unit-02/01-blueprints/.DS_Store b/Unit-02/01-blueprints/.DS_Store
new file mode 100644
index 0000000..a5f568e
Binary files /dev/null and b/Unit-02/01-blueprints/.DS_Store differ
diff --git a/Unit-02/01-blueprints/app.py b/Unit-02/01-blueprints/app.py
new file mode 100644
index 0000000..1fb8c5f
--- /dev/null
+++ b/Unit-02/01-blueprints/app.py
@@ -0,0 +1,4 @@
+from project import app
+
+if __name__ == '__main__':
+ app.run(debug=True,port=3000)
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/manage.py b/Unit-02/01-blueprints/manage.py
new file mode 100644
index 0000000..664490f
--- /dev/null
+++ b/Unit-02/01-blueprints/manage.py
@@ -0,0 +1,10 @@
+from app import app,db
+from flask_script import Manager
+from flask_migrate import Migrate, MigrateCommand
+
+migrate = Migrate(app, db)
+manager = Manager(app)
+manager.add_command('db', MigrateCommand)
+
+if __name__ == '__main__':
+ manager.run()
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/migrations/README b/Unit-02/01-blueprints/migrations/README
new file mode 100755
index 0000000..98e4f9c
--- /dev/null
+++ b/Unit-02/01-blueprints/migrations/README
@@ -0,0 +1 @@
+Generic single-database configuration.
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/migrations/alembic.ini b/Unit-02/01-blueprints/migrations/alembic.ini
new file mode 100644
index 0000000..f8ed480
--- /dev/null
+++ b/Unit-02/01-blueprints/migrations/alembic.ini
@@ -0,0 +1,45 @@
+# A generic, single database configuration.
+
+[alembic]
+# template used to generate migration files
+# file_template = %%(rev)s_%%(slug)s
+
+# set to 'true' to run the environment during
+# the 'revision' command, regardless of autogenerate
+# revision_environment = false
+
+
+# Logging configuration
+[loggers]
+keys = root,sqlalchemy,alembic
+
+[handlers]
+keys = console
+
+[formatters]
+keys = generic
+
+[logger_root]
+level = WARN
+handlers = console
+qualname =
+
+[logger_sqlalchemy]
+level = WARN
+handlers =
+qualname = sqlalchemy.engine
+
+[logger_alembic]
+level = INFO
+handlers =
+qualname = alembic
+
+[handler_console]
+class = StreamHandler
+args = (sys.stderr,)
+level = NOTSET
+formatter = generic
+
+[formatter_generic]
+format = %(levelname)-5.5s [%(name)s] %(message)s
+datefmt = %H:%M:%S
diff --git a/Unit-02/01-blueprints/migrations/env.py b/Unit-02/01-blueprints/migrations/env.py
new file mode 100755
index 0000000..23663ff
--- /dev/null
+++ b/Unit-02/01-blueprints/migrations/env.py
@@ -0,0 +1,87 @@
+from __future__ import with_statement
+from alembic import context
+from sqlalchemy import engine_from_config, pool
+from logging.config import fileConfig
+import logging
+
+# this is the Alembic Config object, which provides
+# access to the values within the .ini file in use.
+config = context.config
+
+# Interpret the config file for Python logging.
+# This line sets up loggers basically.
+fileConfig(config.config_file_name)
+logger = logging.getLogger('alembic.env')
+
+# add your model's MetaData object here
+# for 'autogenerate' support
+# from myapp import mymodel
+# target_metadata = mymodel.Base.metadata
+from flask import current_app
+config.set_main_option('sqlalchemy.url',
+ current_app.config.get('SQLALCHEMY_DATABASE_URI'))
+target_metadata = current_app.extensions['migrate'].db.metadata
+
+# other values from the config, defined by the needs of env.py,
+# can be acquired:
+# my_important_option = config.get_main_option("my_important_option")
+# ... etc.
+
+
+def run_migrations_offline():
+ """Run migrations in 'offline' mode.
+
+ This configures the context with just a URL
+ and not an Engine, though an Engine is acceptable
+ here as well. By skipping the Engine creation
+ we don't even need a DBAPI to be available.
+
+ Calls to context.execute() here emit the given string to the
+ script output.
+
+ """
+ url = config.get_main_option("sqlalchemy.url")
+ context.configure(url=url)
+
+ with context.begin_transaction():
+ context.run_migrations()
+
+
+def run_migrations_online():
+ """Run migrations in 'online' mode.
+
+ In this scenario we need to create an Engine
+ and associate a connection with the context.
+
+ """
+
+ # this callback is used to prevent an auto-migration from being generated
+ # when there are no changes to the schema
+ # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
+ def process_revision_directives(context, revision, directives):
+ if getattr(config.cmd_opts, 'autogenerate', False):
+ script = directives[0]
+ if script.upgrade_ops.is_empty():
+ directives[:] = []
+ logger.info('No changes in schema detected.')
+
+ engine = engine_from_config(config.get_section(config.config_ini_section),
+ prefix='sqlalchemy.',
+ poolclass=pool.NullPool)
+
+ connection = engine.connect()
+ context.configure(connection=connection,
+ target_metadata=target_metadata,
+ process_revision_directives=process_revision_directives,
+ **current_app.extensions['migrate'].configure_args)
+
+ try:
+ with context.begin_transaction():
+ context.run_migrations()
+ finally:
+ connection.close()
+
+if context.is_offline_mode():
+ run_migrations_offline()
+else:
+ run_migrations_online()
diff --git a/Unit-02/01-blueprints/migrations/script.py.mako b/Unit-02/01-blueprints/migrations/script.py.mako
new file mode 100755
index 0000000..2c01563
--- /dev/null
+++ b/Unit-02/01-blueprints/migrations/script.py.mako
@@ -0,0 +1,24 @@
+"""${message}
+
+Revision ID: ${up_revision}
+Revises: ${down_revision | comma,n}
+Create Date: ${create_date}
+
+"""
+from alembic import op
+import sqlalchemy as sa
+${imports if imports else ""}
+
+# revision identifiers, used by Alembic.
+revision = ${repr(up_revision)}
+down_revision = ${repr(down_revision)}
+branch_labels = ${repr(branch_labels)}
+depends_on = ${repr(depends_on)}
+
+
+def upgrade():
+ ${upgrades if upgrades else "pass"}
+
+
+def downgrade():
+ ${downgrades if downgrades else "pass"}
diff --git a/Unit-02/01-blueprints/migrations/versions/d0130005f076_add_messages_table.py b/Unit-02/01-blueprints/migrations/versions/d0130005f076_add_messages_table.py
new file mode 100644
index 0000000..f90b286
--- /dev/null
+++ b/Unit-02/01-blueprints/migrations/versions/d0130005f076_add_messages_table.py
@@ -0,0 +1,34 @@
+"""add messages table
+
+Revision ID: d0130005f076
+Revises: d2def50e1010
+Create Date: 2017-11-30 16:10:09.924022
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'd0130005f076'
+down_revision = 'd2def50e1010'
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('messages',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('content', sa.Text(), nullable=True),
+ sa.Column('user_id', sa.Integer(), nullable=True),
+ sa.ForeignKeyConstraint(['user_id'], ['users.id'], ),
+ sa.PrimaryKeyConstraint('id')
+ )
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_table('messages')
+ # ### end Alembic commands ###
diff --git a/Unit-02/01-blueprints/migrations/versions/d2def50e1010_.py b/Unit-02/01-blueprints/migrations/versions/d2def50e1010_.py
new file mode 100644
index 0000000..47f7d2e
--- /dev/null
+++ b/Unit-02/01-blueprints/migrations/versions/d2def50e1010_.py
@@ -0,0 +1,33 @@
+"""empty message
+
+Revision ID: d2def50e1010
+Revises:
+Create Date: 2017-11-30 14:04:29.263677
+
+"""
+from alembic import op
+import sqlalchemy as sa
+
+
+# revision identifiers, used by Alembic.
+revision = 'd2def50e1010'
+down_revision = None
+branch_labels = None
+depends_on = None
+
+
+def upgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.create_table('users',
+ sa.Column('id', sa.Integer(), nullable=False),
+ sa.Column('first_name', sa.Text(), nullable=True),
+ sa.Column('last_name', sa.Text(), nullable=True),
+ sa.PrimaryKeyConstraint('id')
+ )
+ # ### end Alembic commands ###
+
+
+def downgrade():
+ # ### commands auto generated by Alembic - please adjust! ###
+ op.drop_table('users')
+ # ### end Alembic commands ###
diff --git a/Unit-02/01-blueprints/project/.DS_Store b/Unit-02/01-blueprints/project/.DS_Store
new file mode 100644
index 0000000..a5c9e71
Binary files /dev/null and b/Unit-02/01-blueprints/project/.DS_Store differ
diff --git a/Unit-02/01-blueprints/project/__init__.py b/Unit-02/01-blueprints/project/__init__.py
new file mode 100644
index 0000000..126a835
--- /dev/null
+++ b/Unit-02/01-blueprints/project/__init__.py
@@ -0,0 +1,24 @@
+from flask import Flask, url_for, redirect
+from flask_sqlalchemy import SQLAlchemy
+from flask_modus import Modus
+import os
+
+
+app = Flask(__name__)
+app.config['SQLALCHEMY_DATABASE_URI'] = 'postgres://localhost/users-app-db'
+app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
+app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY')
+db = SQLAlchemy(app)
+modus = Modus(app)
+
+
+from project.users.views import users_blueprint
+from project.messages.views import messages_blueprint
+
+app.register_blueprint(users_blueprint, url_prefix='/users')
+app.register_blueprint(messages_blueprint, url_prefix='/users//messages')
+
+@app.route('/')
+def root():
+ return redirect(url_for('users.index'))
+
diff --git a/Unit-02/01-blueprints/project/messages/.DS_Store b/Unit-02/01-blueprints/project/messages/.DS_Store
new file mode 100644
index 0000000..e7390b5
Binary files /dev/null and b/Unit-02/01-blueprints/project/messages/.DS_Store differ
diff --git a/Unit-02/01-blueprints/project/messages/forms.py b/Unit-02/01-blueprints/project/messages/forms.py
new file mode 100644
index 0000000..2d6f277
--- /dev/null
+++ b/Unit-02/01-blueprints/project/messages/forms.py
@@ -0,0 +1,8 @@
+from flask_wtf import FlaskForm
+from wtforms import StringField, validators
+
+class MessageForm(FlaskForm):
+ content = StringField('Content', [validators.DataRequired()])
+
+class DeleteForm(FlaskForm):
+ pass
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/messages/templates/.DS_Store b/Unit-02/01-blueprints/project/messages/templates/.DS_Store
new file mode 100644
index 0000000..bee0e76
Binary files /dev/null and b/Unit-02/01-blueprints/project/messages/templates/.DS_Store differ
diff --git a/Unit-02/01-blueprints/project/messages/templates/messages/edit.html b/Unit-02/01-blueprints/project/messages/templates/messages/edit.html
new file mode 100644
index 0000000..6347f10
--- /dev/null
+++ b/Unit-02/01-blueprints/project/messages/templates/messages/edit.html
@@ -0,0 +1,22 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Edit message
+
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/messages/templates/messages/index.html b/Unit-02/01-blueprints/project/messages/templates/messages/index.html
new file mode 100644
index 0000000..bcd44db
--- /dev/null
+++ b/Unit-02/01-blueprints/project/messages/templates/messages/index.html
@@ -0,0 +1,17 @@
+{% extends 'base.html' %}
+
+{% block content %}
+ Add a new message, {{ user.first_name }}!
+ See all the messages for {{user.first_name}}
+ {% for message in user.messages %}
+
+ {{ message.content }}
+
+ Edit message
+
+
+{% endfor %}
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/messages/templates/messages/new.html b/Unit-02/01-blueprints/project/messages/templates/messages/new.html
new file mode 100644
index 0000000..c7ac8c0
--- /dev/null
+++ b/Unit-02/01-blueprints/project/messages/templates/messages/new.html
@@ -0,0 +1,22 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Add a new message
+
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/messages/templates/messages/show.html b/Unit-02/01-blueprints/project/messages/templates/messages/show.html
new file mode 100644
index 0000000..e3522fe
--- /dev/null
+++ b/Unit-02/01-blueprints/project/messages/templates/messages/show.html
@@ -0,0 +1,9 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Here is your message: {{message.content}}
+
+Edit this message!
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/messages/views.py b/Unit-02/01-blueprints/project/messages/views.py
new file mode 100644
index 0000000..49d7811
--- /dev/null
+++ b/Unit-02/01-blueprints/project/messages/views.py
@@ -0,0 +1,64 @@
+from flask import redirect, render_template, request, url_for, flash, Blueprint
+from project.messages.forms import MessageForm, DeleteForm
+from project.models import Message, User
+from project import db
+
+messages_blueprint = Blueprint(
+ 'messages',
+ __name__,
+ template_folder='templates'
+ )
+
+@messages_blueprint.route('/', methods=['GET', 'POST'])
+def index(user_id):
+ #find a user
+ delete_form = DeleteForm()
+ if request.method == 'POST':
+ message_form = MessageForm(request.form)
+ if message_form.validate():
+ new_message = Message(message_form.content.data, user_id)
+ db.session.add(new_message)
+ db.session.commit()
+ flash('Message Created!')
+ return redirect(url_for('messages.index', user_id=user_id))
+ return render_template('messages/new.html', user=User.query.get(user_id), form=message_form)
+ return render_template('messages/index.html', user=User.query.get(user_id), delete_form=delete_form)
+
+# NEW MESSAGE
+@messages_blueprint.route('/new', methods=['GET','POST'])
+def new(user_id):
+ message_form = MessageForm()
+ return render_template('messages/new.html', user=User.query.get(user_id), form=message_form)
+
+#EDIT MESSAGE FORM
+@messages_blueprint.route('//edit')
+def edit(user_id, id):
+ found_message = Message.query.get(id)
+ message_form = MessageForm(obj=found_message)
+ return render_template('messages/edit.html', message=found_message, form=message_form)
+
+# EDIT MESSAGE
+@messages_blueprint.route('/', methods=['GET','PATCH','DELETE'])
+def show(user_id, id):
+ found_message = Message.query.get(id)
+ if request.method == b'PATCH':
+ message_form = MessageForm(request.form)
+ if message_form.validate():
+ found_message.content = message_form.content.data
+ db.session.add(found_message)
+ db.session.commit()
+ flash('Message Updated!')
+ return redirect(url_for('messages.index', user_id=user_id))
+ return render_template('messages/edit.html', message=found_message, form=message_form)
+ if request.method == b'DELETE':
+ delete_form = DeleteForm(request.form)
+ if delete_form.validate():
+ db.session.delete(found_message)
+ db.session.commit()
+ flash('Message Deleted!')
+ return redirect(url_for('messages.index', user_id=user_id))
+ return render_template('messages/show.html', message=found_message)
+
+
+
+
diff --git a/Unit-02/01-blueprints/project/models.py b/Unit-02/01-blueprints/project/models.py
new file mode 100644
index 0000000..9ce17e4
--- /dev/null
+++ b/Unit-02/01-blueprints/project/models.py
@@ -0,0 +1,32 @@
+from project import db
+
+
+class User(db.Model):
+
+ __tablename__ = 'users'
+ __table_args__ = {'extend_existing': True}
+
+
+ id = db.Column(db.Integer, primary_key=True)
+ first_name = db.Column(db.Text)
+ last_name = db.Column(db.Text)
+ messages = db.relationship('Message', backref='user', lazy='dynamic', cascade='all,delete')
+
+ def __init__(self, first_name, last_name):
+ self.first_name = first_name
+ self.last_name = last_name
+
+
+class Message(db.Model):
+
+ __tablename__ = 'messages'
+ __table_args__ = {'extend_existing': True}
+
+# DDL
+ id = db.Column(db.Integer, primary_key=True)
+ content = db.Column(db.Text)
+ user_id = db.Column(db.Integer, db.ForeignKey('users.id'))
+# DML
+ def __init__(self, content, user_id):
+ self.content = content
+ self.user_id = user_id
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/templates/.DS_Store b/Unit-02/01-blueprints/project/templates/.DS_Store
new file mode 100644
index 0000000..5008ddf
Binary files /dev/null and b/Unit-02/01-blueprints/project/templates/.DS_Store differ
diff --git a/Unit-02/01-blueprints/project/templates/base.html b/Unit-02/01-blueprints/project/templates/base.html
new file mode 100644
index 0000000..21c41d9
--- /dev/null
+++ b/Unit-02/01-blueprints/project/templates/base.html
@@ -0,0 +1,38 @@
+
+
+
+
+ Users App!!
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {% with messages = get_flashed_messages() %}
+ {% if messages %}
+ {% for message in messages %}
+
{{message}}
+ {% endfor %}
+ {% endif %}
+ {% endwith %}
+
+
+ {% block content %}
+ {% endblock %}
+
+
+
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/users/.DS_Store b/Unit-02/01-blueprints/project/users/.DS_Store
new file mode 100644
index 0000000..494a88c
Binary files /dev/null and b/Unit-02/01-blueprints/project/users/.DS_Store differ
diff --git a/Unit-02/01-blueprints/project/users/forms.py b/Unit-02/01-blueprints/project/users/forms.py
new file mode 100644
index 0000000..49f44da
--- /dev/null
+++ b/Unit-02/01-blueprints/project/users/forms.py
@@ -0,0 +1,9 @@
+from flask_wtf import FlaskForm
+from wtforms import StringField, validators
+
+class UserForm(FlaskForm):
+ first_name = StringField('First Name', [validators.DataRequired()])
+ last_name = StringField('Last Name', [validators.DataRequired()])
+
+class DeleteForm(FlaskForm):
+ pass
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/users/templates/.DS_Store b/Unit-02/01-blueprints/project/users/templates/.DS_Store
new file mode 100644
index 0000000..ec0ac21
Binary files /dev/null and b/Unit-02/01-blueprints/project/users/templates/.DS_Store differ
diff --git a/Unit-02/01-blueprints/project/users/templates/users/edit.html b/Unit-02/01-blueprints/project/users/templates/users/edit.html
new file mode 100644
index 0000000..06cbbb1
--- /dev/null
+++ b/Unit-02/01-blueprints/project/users/templates/users/edit.html
@@ -0,0 +1,23 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Edit: {{ user.first_name }} {{ user.last_name }}
+
+
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/users/templates/users/index.html b/Unit-02/01-blueprints/project/users/templates/users/index.html
new file mode 100644
index 0000000..48bcc3a
--- /dev/null
+++ b/Unit-02/01-blueprints/project/users/templates/users/index.html
@@ -0,0 +1,23 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Make a new user!
+See all users!
+
+{% for user in users %}
+
+
+
{{ user.first_name }} {{ user.last_name }}
+ See all messages for {{user.first_name}}
+
+ Edit a user!
+
+
+
+
+{% endfor %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/users/templates/users/new.html b/Unit-02/01-blueprints/project/users/templates/users/new.html
new file mode 100644
index 0000000..dcb4f62
--- /dev/null
+++ b/Unit-02/01-blueprints/project/users/templates/users/new.html
@@ -0,0 +1,22 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Add a new user!
+
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/users/templates/users/show.html b/Unit-02/01-blueprints/project/users/templates/users/show.html
new file mode 100644
index 0000000..59cc0ab
--- /dev/null
+++ b/Unit-02/01-blueprints/project/users/templates/users/show.html
@@ -0,0 +1,12 @@
+{% extends 'base.html' %}
+
+{% block content %}
+Here is your user: {{user.first_name}} {{user.last_name}}
+
+Edit this user!
+
+Delete user
+
+{% endblock %}
\ No newline at end of file
diff --git a/Unit-02/01-blueprints/project/users/views.py b/Unit-02/01-blueprints/project/users/views.py
new file mode 100644
index 0000000..c14a6b3
--- /dev/null
+++ b/Unit-02/01-blueprints/project/users/views.py
@@ -0,0 +1,58 @@
+from flask import redirect, render_template, request, url_for, flash, Blueprint
+from project.users.forms import UserForm, DeleteForm
+from project.models import User
+from project import db
+
+users_blueprint = Blueprint(
+ 'users',
+ __name__,
+ template_folder='templates'
+ )
+
+@users_blueprint.route('/', methods=['GET', 'POST'])
+def index():
+ delete_form = DeleteForm()
+ if request.method == 'POST':
+ form = UserForm(request.form)
+ if form.validate():
+ new_user = User(request.form['first_name'], request.form['last_name'])
+ db.session.add(new_user)
+ db.session.commit()
+ flash('User Created!')
+ return redirect(url_for('users.index'))
+ else:
+ return render_template('users/new.html', form=form)
+ return render_template('users/index.html', users=User.query.all(), delete_form=delete_form)
+
+@users_blueprint.route('/new')
+def new():
+ user_form = UserForm()
+ return render_template('users/new.html', form=user_form)
+
+@users_blueprint.route('/', methods=['GET','PATCH', 'DELETE'])
+def show(id):
+ found_user = User.query.get(id)
+ if request.method == b'PATCH':
+ form = UserForm(request.form)
+ if form.validate():
+ found_user.first_name = form.first_name.data
+ found_user.last_name = form.last_name.data
+ db.session.add(found_user)
+ db.session.commit()
+ flash('User Updated!')
+ return redirect(url_for('users.index'))
+ return render_template('users/edit.html', user=found_user, form=form)
+ if request.method == b'DELETE':
+ delete_form = DeleteForm(request.form)
+ if delete_form.validate():
+ db.session.delete(found_user)
+ db.session.commit()
+ flash('User Deleted!')
+ return redirect(url_for('users.index'))
+ return render_template('users/show.html', user=found_user)
+
+@users_blueprint.route('//edit')
+def edit(id):
+ found_user = User.query.get(id)
+ user_form = UserForm(obj=found_user)
+ return render_template('users/edit.html', user=found_user, form=user_form)
diff --git a/Unit-02/01-blueprints/readme.md b/Unit-02/01-blueprints/readme.md
index afe8a3c..4f9ca1a 100644
--- a/Unit-02/01-blueprints/readme.md
+++ b/Unit-02/01-blueprints/readme.md
@@ -3,10 +3,21 @@
### Part I - Questions
1. Describe the MVC pattern.
+
+MVC is a pattern that is used to create web apps. There are three main parts to the pattern: model, view, controller. These three parts help manage the interactions between the user and the application
+
2. In the MVC pattern, does the model communicate directly with the view?
+
+The model does not communicate directly with the view. Rather, the controler receives a request from the user and looks to the models to retrieve the necessary data. Once it's compiled the controller then sends off the product to view.
+
2. What is the purpose of blueprints?
+
+It helps to organize and better structure our app building code. Currently, the code we've built all lives in one main file, and blueprints helps to separate the code into main categories
+
3. How does using blueprints help us organize bigger applications?
+Blueprints uses the MVC structure to break apart our app's code. In order to do so, additional folders are created to help organize each section of code.
+
### Part II - Exercise
1. Refactor your users and messages app to use blueprints. Make sure to have a separate file for `models.py`, `views.py`, and `forms.py`. You should have a working 1 to Many application with blueprints when this exercise is complete!