diff --git a/.gitignore b/.gitignore index 7de88e3..a5e9648 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,8 @@ __pycache__/ *.db3 *.sqlite *.sqlite3 +<<<<<<< HEAD +======= +*.log +local_settings.py +>>>>>>> 1688b0ad1e792c142f9f753754c029e1225d374f diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..0785be5 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: gunicorn squawker.wsgi --log-file - diff --git a/README.md b/README.md index 1635648..69d8797 100644 --- a/README.md +++ b/README.md @@ -1,106 +1,12 @@ -# Squawker +# BuddyBear -In this assignment, you will build simplified Twitter clone. We'll refer to the individual messages as "squawks". +## Narrative +1 in 68 children suffer from autism spectrum disorder, a disorder that prevents them from comprehending basic human emotion. We are developing Buddy Bear, a companion that utilizes computer vision to recognize emotions in others and conveys this emotion to the child in a simple, easy to understand manner. -## Requirements +## Product -* The homepage (`/`) contains: - * A single form, to post a new squawk (**5%**) - * All past squawks (**20%**) - * Sorted from newest to oldest (**20%**) -* Submitting the form: - 1. Creates a new squawk (**30%**) - 1. Shows / takes the user back to the homepage (**5%**) - * In other words, they should see the updated homepage with the new squawk. -* Squawks are limited to 140 characters - * Client-side (**5%**) - * Uses HTML5 form validation - * Server-side (**10%**) - * Responds with a status code of 400 if the form is submitted with invalid data. -* Passes Code Climate checks (**5%**) -* The site works without JavaScript -* Built using [Flask](http://flask.pocoo.org/) and [`sqlite3`](https://docs.python.org/3/library/sqlite3.html) +Buddy Bear - physical device -Visual styling is not considered as part of the score, though feel free to get creative! In other words, feel free to make your site pretty, but not a problem if it isn't. +Dashboard - metric tracking -### Extra credit -* Pagination (**20%**) - * The squawks are shown 20 at a time - * There's a `Next` link to see older squawks, if there are any - -## Setup - -1. Update your [VM](https://github.com/startup-systems/vm), if you didn't do so for the [time](https://docs.google.com/document/d/15VzRMLHLGm_l9dzUObQlsOoY12J_jH3U0b9Bu2yi6EI/edit#heading=h.lyptz0o698my) assignment already. From your host machine: - - ```shell - cd path/to/vm/ - git pull -s recursive -X ours https://github.com/startup-systems/vm.git master - vagrant reload - ``` - -1. [Set up the database.](#set-up-the-database) - -## Development workflow - -1. Start the server. From your VM: - - ```shell - cd /vagrant/squawker - pip3 install -r requirements.txt - FLASK_APP=squawker/server.py FLASK_DEBUG=1 flask run --host=0.0.0.0 - ``` - -1. Open http://localhost:5000 from your host machine. -1. Modify [`squawker/server.py`](squawker/server.py). -1. Refresh. - -## Set up the database - -Note that this will delete any existing content. - -1. Modify the [`squawker/schema.sql`](squawker/schema.sql) file. -1. Run - - ```shell - FLASK_APP=squawker/server.py flask initdb - ``` -Repeat these steps when you need to update the schema. - -## Running tests locally - -Run the following from this directory: - -```shell -# run the pytests -pytest --tb short -# run the pep8 checks -pep8 -# check the extra credit -pytest --tb short --runxfail -``` - -## Things you will need - -* [Flask template(s)](http://flask.pocoo.org/docs/0.11/quickstart/#rendering-templates) - * [Jinja2 syntax](http://jinja.pocoo.org/docs/dev/templates/) -* An [HTML form](https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Forms) -* Change/addition of routes in Flask -* Some basic SQL understanding -* SQLite3 CLI - * Useful for inspecting your database - * Install in your VM with - - ```shell - sudo apt-get update - sudo apt-get install sqlite3 - ``` - -### Code Climate checks - -If you want to try running these locally: - -1. [Install Docker](https://docs.docker.com/engine/installation/linux/ubuntulinux/) (follow the "Ubuntu Xenial 16.04 (LTS)" instructions) -1. Run the [Code Climate CLI](https://github.com/codeclimate/codeclimate#readme). - -Note that **this is advanced**, so don't worry if you have trouble getting it running. diff --git a/main/__init__.py b/main/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/main/admin.py b/main/admin.py new file mode 100644 index 0000000..dbefa63 --- /dev/null +++ b/main/admin.py @@ -0,0 +1,5 @@ +from django.contrib import admin +from .models import Squawk + +# Register your models here. +admin.site.register(Squawk) diff --git a/main/migrations/0001_initial.py b/main/migrations/0001_initial.py new file mode 100644 index 0000000..06062f0 --- /dev/null +++ b/main/migrations/0001_initial.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Squawk', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('message', models.CharField(max_length=140)), + ('created', models.DateTimeField(auto_now_add=True)), + ], + ), + ] diff --git a/main/migrations/__init__.py b/main/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/main/models.py b/main/models.py new file mode 100644 index 0000000..b0533ea --- /dev/null +++ b/main/models.py @@ -0,0 +1,7 @@ +from django.db import models + +# Create your models here. +class Squawk(models.Model): + message = models.CharField(max_length=140) + created = models.DateTimeField(auto_now_add=True) + diff --git a/main/templates/index.html b/main/templates/index.html new file mode 100644 index 0000000..8322708 --- /dev/null +++ b/main/templates/index.html @@ -0,0 +1,38 @@ + + + +
+ + + + + +