This is the server side component to the first NMX prototype project.
Set up a virtualenv (assuming you already installed virtualenv with pip) and install dependencies.
virtualenv --python=python3.6 env
source env/bin/activate
pip install -r requirements.txt
and deactivate
to leave the virtualenv.
You need a copy of ./firebase.local.json
and ./keys.local.json
. You can
copy the templates and add your own keys or get the keys from Mozilla's
engineering gdrive. If you don't have access, please contact a team member.
With the keys ready, run:
python -m samples.firebase-test
You can view real-time changes to the database on the console.
Testing is done via pytest:
pytest tests
All tests should pass before landing on master
.
The project is a flask
server which puts jobs on a rq
task queue.
Thus, the app is run in three parts:
Run redis:
redis-server
Then run the flask web app:
python app.py
Then run the workers which will consume the tasks coming from the web server.
rq worker -c rq_settings
Follow the comments in scripts/crawl_hawaii.py.
Caution: any scripts you run will overwrite production data. Be sure:
Please avoid polluting the production DB.
To do this, in app/constants.py, change to:
_tablePrefix = "production/"