Code Monkey home page Code Monkey logo

squawker's Introduction

Squawker

In this assignment, you will build simplified Twitter clone. We'll refer to the individual messages as "squawks".

Requirements

  • 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%)
    2. 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 and sqlite3

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.

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, if you didn't do so for the time assignment already. From your host machine:

    cd path/to/vm/
    git pull -s recursive -X ours https://github.com/startup-systems/vm.git master
    vagrant reload
  2. Set up the database.

Development workflow

  1. Start the server. From your VM:

    cd /vagrant/squawker
    pip3 install -r requirements.txt
    FLASK_APP=squawker/server.py FLASK_DEBUG=1 flask run --host=0.0.0.0
  2. Open http://localhost:5000 from your host machine.

  3. Modify squawker/server.py.

  4. Refresh.

Set up the database

Note that this will delete any existing content.

  1. Modify the squawker/schema.sql file.

  2. Run

    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:

# 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)
  • An HTML form
  • Change/addition of routes in Flask
  • Some basic SQL understanding
  • SQLite3 CLI
    • Useful for inspecting your database

    • Install in your VM with

      sudo apt-get update
      sudo apt-get install sqlite3

Code Climate checks

If you want to try running these locally:

  1. Install Docker (follow the "Ubuntu Xenial 16.04 (LTS)" instructions)
  2. Run the Code Climate CLI.

Note that this is advanced, so don't worry if you have trouble getting it running.

squawker's People

Contributors

afeld avatar trishalaneeraj avatar grutt avatar

Watchers

James Cloos avatar

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.