Skip to content

The shared repository for Media Cloud web apps (Explorer, Source Manager, Topic Mapper)

License

Notifications You must be signed in to change notification settings

CodeForAfrica/web-tools

 
 

Repository files navigation

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 npm:

  • 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)
  • npm 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.4 If you get a connection refused error, make sure you've started the server by running brew services start mongodb-community@4.4

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.

NOTE: MEDIA_CLOUD_API_KEY and MEDIA_CLOUD_API_URL are required. You can find your MEDIA_CLOUD_API_KEY on your profile page.

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)
  • npm run topics-dev or npm 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:

$ npm run lint_fix

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

About

The shared repository for Media Cloud web apps (Explorer, Source Manager, Topic Mapper)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 99.9%
  • Python 0.1%
  • SCSS 0.0%
  • HTML 0.0%
  • Shell 0.0%
  • Makefile 0.0%