mozilla-mobile / prox-server

[INACTIVE] Server & data scripts for the Prox client.
https://github.com/mozilla-mobile/prox/
Mozilla Public License 2.0
5 stars 5 forks source link
mozilla nmx prox

prox-server

This is the server side component to the first NMX prototype project.

Setup

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.

Services keys

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.

Firebase

With the keys ready, run:

python -m samples.firebase-test

You can view real-time changes to the database on the console.

Testing

Testing is done via pytest:

pytest tests

All tests should pass before landing on master.

Running

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

Pre-caching a location?

Follow the comments in scripts/crawl_hawaii.py.

Point to production DB in local builds

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/"