Skip to content

camrandev/flask-warbler

Repository files navigation

Warbler - Fullstack Twitter clone

Warbler is a Twitter clone. It is currently built as a multi-page application using server-side rendering with Jinja. The main goal of this project was to get comfortable with writing a backend in flask, with a focus on writing tests for certain portions of the code.

View the deployed site here, deployed with Render and Surge

Login: tuckerdiane | Password: password

Tech Stack

Python Flask Postgres Jinja jQuery

Features

Here is an overview of some of the key features

  • Users are able to create accounts, log in, and sign up
  • Users are able to send warbles, like the warbles of other users, and delete their own warbles
  • Users are able to follow + unfollow other users, as well as view a list of who is following them
  • Users are able to update their profile, including selecting a new profile picture
  • Sessions are used to persist users logged in state
  • currently 74% test coverage

Local setup instructions

Fork and clone this repo

from the root folder of your forked repo

1.) Create the virtual environment and install the requirements using the following terminal commands:

python3 -m venv venv
source venv/bin/activate
pip3 install -r requirements.txt

2.) Set up your local database (this assumes you have Postgres installed, if not, you can find instructions here

psql
CREATE DATABASE warbler;
(ctrl+D)
python3 seed.py

3.) Setup environment variables in .env

  • create a .env file at the root of the project
  • copy and paste the following code into your new .env file
    SECRET_KEY=secret
    DATABASE_URL=postgresql:///warbler
    

4.) Run the development server.

flask run -p 5001

Flask defaults to port 5000, however, many MacOS devices use port 5000 for airplay.

Warbler will now be viewable on localhost:5001

Tests

  • Warbler currently has 74% test coverage
  • Due to the time constraints of the project, we decided to focus on features over testing. However, testing is a top priority as I continue to work on the project.

to run the tests

python -m unittest

To-Dos

  • Rebuild the frontend as a single page application using React and React-router, with a focus on responsiveness and accessibility
  • refactor a number of non-ajax calls into ajax calls (particularly the "like" and "unlike" buttons).
  • Fix a bug where the "like" icon is not displaying correctly on certain mobile screens
  • write tests to get coverage above 95%
  • Refactor the backend for increased maintainability using Flask blueprints or potentially even rebuild the whole thing using Django

Acknowledgements

Warbler was built during my time at Rithm School, as part of a 3-day sprint. My partner on the backend was Hannah Nguyen