Skip to content

#️⃣FBHack Melbourne 2018 - An open approach to news and media content quality evaluation

Notifications You must be signed in to change notification settings

thundergolfer/source-rank

Repository files navigation

Source Rank - Facebook Hackathon 2018 - Build Status Run in Postman



Newcomers, see the intro doc to get an idea of what this project is about.


USEFUL STUFF


Overview

This project:

  • has a React JS web app front-end,
  • uses Flask and flask_restful for the backend APIs,
  • uses PostGreSQL for data persistence
  • Heroku as the app cloud platform
  • and various Python packages for the background workers

Installation

Frontend

  1. cd frontend
  2. Install the front-end dependencies by running npm install.
  3. Run the project with:
    • npm start - Runs a development server with hot reloading
    • npm run build - Creates a /dist folder containing a minified bundle (bundle.js) and index.html
    • npm run serve - Serves the /dist folder on an express server

Backend

  1. Back-end Python dependencies are managed by pipenv. Do pipenv install --dev to install everything.
  2. Install PostGreSQL for local development.
  3. You need to run export DATABASE_URL=postgresql://localhost/$(whoami) && export FLASK_APP=./app.py (for Windows use set not export)
  4. Run flask db init (probably don't want to do this)

Messenger Bot

  1. cd messenger-bot
  2. Install with yarn by running yarn.

Chrome Extension

coming soon

Deployment

Web Application

To deploy the web app, you'll need Heroku set up.

  1. Get the Heroku CLI if you don't already have it.
  2. You will need to get added as a collaborator to the app.

The web application is deployed automatically on push to master

Messenger Bot

  1. cd messenger-bot
  2. (FIRST TIME ONLY) now switch source-rank
  3. yarn run deploy
  4. Check sourcerank-fb-messenger-bot.now.sh (latest deployment)

Chrome Extension

coming soon

Review Apps

For our Heroku provided 'review apps' the DB isn't automatically created. A command of this form can be manually run after the review app is create to copy over data

heroku pg:copy facebook-hack-2018::DATABASE_URL DATABASE_URL --app facebook-hack-2018-pr-1384 --confirm facebook-hack-2018-pr-1384

Development

Running The app

Back-End

python app.py

Front-end
  1. cd frontend/

  2. yarn run start

Messenger bot
  1. yarn run start
Chrome Extension

coming soon

Migrations

Database schema migrations are performed by editing the FlaskSQLAlchemy models in backend/models.py and then using Flask-Migrate to migrate with the command flask db migrate.

After running that command, check the created migration file in migrations/. If it looks good, run flask db upgrade to apply the migration and then commit the new migration file to the repo.