A simplistic interface to search and consult CADA advices.
This is the engine behind http://cada.data.gouv.fr.
CADA has been tested on Python 2.7, MongoDB 2.4+ and ElasticSearch 1.1.
The ElasticSearch ICU Analysis plugin is required.
You can install it with:
bin/plugin -install elasticsearch/elasticsearch-analysis-icu/2.1.0
You can install Cada with pip:
$ pip install cada
or with easy_install:
$ easy_install cada
You need to create the cada working directory, designed by $HOME
in this documentation:
$ mkdir -p $HOME && cd $HOME
$ vim cada.cfg # See configuration
$ wget http://cada.data.gouv.fr/export -O data.csv
$ cada load data.csv # Load initial data
$ cada static # Optional: collect static assets for proper caching
$ cada runserver
All configuration is done through the cada.cfg
file in $HOME
.
It's basically a Python file with constants defined in it:
SERVER_NAME
: the public server name. Mainly used in emails.SECRET_KEY
: the common crypto hash.Used for session by exemple.ELASTICSEARCH_URL
: the ElasticSearch server URL inhost:port
format. Default tolocalhost:9200
if not setMONGODB_SETTINGS
: a dictionary to configure MongoDB. Default to{'DB': 'cada'}
. See the official flask-mongoengine documentation for more details.
Mail server configuration is done through the following variables:
MAIL_SERVER
: SMTP server hostname. Default tolocalhost
.MAIL_PORT
: SMTP server port. Default to25
.MAIL_USE_TLS
: activate TLS. Default toFalse
.MAIL_USE_SSL
: activate SSL. Default toFalse
.MAIL_USERNAME
: optional SMTP server username.MAIL_PASSWORD
: optional SMTP server password.MAIL_DEFAULT_SENDER
: Sender email used for mailings. Default tocada@localhost
.ANON_ALERT_MAIL
: destination mail for anonymisation alerts. Default tocada.alert@localhost
.
See the official Flask-Mail documentation for more details.
There is an optional support for Sentry. You need to install the required dependencies:
$ pip install raven[flask]
# Or, to install it with cada
$ pip install cada[sentry]
You need to add your Sentry DSN to the configuration
SENTRY_DSN = 'https://xxxxx:[email protected]/id'
There is an optional Piwik support. You simply need to add your Piwik server URL and your Piwik project ID to the configuration:
PIWIK_URL = 'piwik.mydomain.com'
PIWIK_ID = X