Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Latest commit

 

History

History
96 lines (70 loc) · 3.84 KB

README.md

File metadata and controls

96 lines (70 loc) · 3.84 KB

Media Cloud Web Tools

This is a shared repository for all the front-facing Media Cloud web tools. This includes:

Check out the doc folder for more documentation.

Dev Installation

Git:

  • git submodule update --init --recursive

Python:

  • Follow the instructions in doc/python-versions.md to setup Python the way we do
  • Once you've got Python setup, install the requirements by running pip install -r requirements.txt

Node and yarn:

  • On Windows, make sure to create an environment variable: set NODE_ENV=dev
  • make sure your node installation is up-to-date (we work with v8.2.1 right now)
  • yarn install to install all the package dependencies (as specified in the package.json)

MongoDB: Install MongoDb:

  • brew tap mongodb/brew
  • brew install mongodb-community@4.2 If you get a connection refused error, make sure you've started the server by running brew services start mongodb-community@4.2

Redis: Install Redis We develop on OS X and install via the HomeBrew package manager: brew install redis

MemCache: On OSX, make sure to run brew install libmemcached otherwise you'll get an error about pylibmc failing to install (http://brew.sh)

Multi-platform setup: Coming soon

Configuration

Copy config/app.config.template to config/app.config and fill in the required info there.

Running the Apps

You need to open two terminal windows and run one thing in each (so the hot-reloading can work):

  • redis-server to start redis (if it's not running already)
  • yarn run topics-dev or yarn run sources-dev
  • python run.py
    • if you get flask errors, run the pip install -r requirements.txt line again. On Mac Osx, you may need to run with --ignore-installed

Toolchain

You will make your life easier by installing these tools:

Development

Python linting rules can be found in .pylintrc. To run linting run:

make lint.py

To run JS linting rules:

npx eslint

We use PyCharm and run linting on the flying using the pylint-pycharm plugin. After installing it, enable real-time inspection:

  • Preferences > Editor > Inspections > Pylint
  • Check "Pylint real-time scan"

A pre-commit hooks will run JavaScript linting (e.g. when you commit, linting will be run). You can try to automatically fix JavaScript linting errors by running:

$ yarn run lint_fix

Not all errors can be fixed this way and for more details about the linting error see eslint.