It's recommended that you use a virtualenv:
$ virtualenv-3.3 ~/envs/brain --no-site-packages
$ source ~/envs/brain/bin/activate
Run MongoDB:
$ mongod
Clone repo and then install dependencies:
$ git clone https://github.com/publicscience/brain.git
$ cd brain
$ pip install -r requirements.txt
$ python -m nltk.downloader punkt
Note that you may need to install numpy first:
$ pip install numpy
Setup Flask configuration:
$ mv config-sample.py config.py
$ vi config.py
Setup Twitter API access:
$ mv app/brain/config-sample.json app/brain/config.json
$ vi app/brain/config.json
(see below for more info)
Run tests to make sure everything's working:
$ nosetests
Run the Flask application:
$ python application.py
Check out the site at localhost:5000 (by default).
The important endpoints at the moment are /muses/ and /config/.
To setup Twitter API access for your Twitter account:
-
Authorize Twitter development access to your account through here.
-
Register your application through that process.
-
On your app's page in the Twitter dev site, set its
Access leveltoRead and write. -
Then generate an access token for your app.
-
Set the required values in
app/brain/config.json.
/flask_mongoengine/wtf/orm.py
line 225 has a Python 3 incompatibility.
It uses iteritems(), it should be items().
0 * * * * cd /srv/brain; /env/brain/bin/python -c "from app.brain import ponder; ponder()"
30 * * * * cd /srv/brain; /env/brain/bin/python -c "from app.brain import consider; consider()"