This is a shared repository for all the front-facing Media Cloud web tools. This includes:
Check out the doc
folder for more documentation.
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 thepackage.json
)
MongoDB: Install MongoDb:
brew tap mongodb/brew
brew install [email protected]
If you get a connection refused error, make sure you've started the server by runningbrew services start [email protected]
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
Copy config/app.config.template
to config/app.config
and fill in the required info there.
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
oryarn 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
- if you get flask errors, run the
You will make your life easier by installing these tools:
- PyCharm - our IDE of choice for Python development
- Redux DevTools Chrome extension
- React Developer Tools Chrome Extension.
- Set up your environment with SublimeText and linting following these instructions.
- Note - you need to tell Sublime to install the Sublime package control manager and then you need to install the necessary packages using Sublime's command line. That's all there in the link, just make sure you follow the prompts explicity.
- To browse your local DB on a Mac use MongoHub, or MongoExpress for a web-based UI
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.