tiwareep / squawker

Twitter clone assignment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

Twitter clone assignment


Languages

Language:Python 83.2%Language:HTML 12.8%Language:Shell 4.0%