In this assignment, you will build simplified Twitter clone. We'll refer to the individual messages as "squawks".
- 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:
- Creates a new squawk (30%)
- 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.
- Client-side (5%)
- 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.
- Pagination (20%)
- The squawks are shown 20 at a time
- There's a
Next
link to see older squawks, if there are any
-
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
-
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
-
Open http://localhost:5000 from your host machine.
-
Modify
squawker/server.py
. -
Refresh.
Note that this will delete any existing content.
-
Modify the
squawker/schema.sql
file. -
Run
FLASK_APP=squawker/server.py flask initdb
Repeat these steps when you need to update the schema.
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
- 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
-
If you want to try running these locally:
- Install Docker (follow the "Ubuntu Xenial 16.04 (LTS)" instructions)
- Run the Code Climate CLI.
Note that this is advanced, so don't worry if you have trouble getting it running.