- Django (1.10.5)
- Postgres (tested with 9.5.2 and 9.5.5)
- Redis (tested with 3.2.4 and 3.2.6)
- EmbedLy account
- ElasticSearch (tested with 2.3.3 and 2.4.0)
- you'll need to add
script.inline: true
andscript.indexed: true
to the elasticsearch.yml file locally
- you'll need to add
- AWS S3 account
- SMTP server/service
- Node (7.4.0)
- Python (tested with 3.5 and 3.6)
See requirements.txt and package.json for all libraries and modules that are used and see sample.env for configuration examples
- create/enter virtual environment
$ pip install -r requirements.txt
$ npm install
$ (cd node_modules/material-ui; npm install)
- create database
- edit .env and update database URL
- create tables (
python manage.py migrate
) - create elasticsearch indices
- main index:
curl -XPUT <SEARCHBOX_URL>/<ELASTICSEARCH_INDEX>
- query index:
curl -XPUT <SEARCHBOX_URL>/<ELASTICSEARCH_SEARCH_STATS_INDEX>
- main index:
- set up daily process to execute
bin/daily_tasks
(this could be a crontab entry or using the Heroku Scheduler add-on)
- Get content (cp/sync from aws)
- Load content into database (
$ python manage.py import_content <content directory>
) - Recreate the document index (
$ python manage.py recreate_index
) - Create the LDA data (
$ python manage.py create_and_upload_lda
) - Install the LDA data (
$ python manage.py fetch_lda
) - Create query index and mappings (
$ python manage.py create_query_index
)
- Configure feed (
$ python manage.py add_rss <url>
) - Wait for content to be loaded (this is done every 24 hours during the night)
or ingest documents manually (
$ python manage.py refresh_rss
)
To access the Web UI (with hot loading of both python and javascript):
$ npm run serve
$ heroku local
(or$ python manage.py runserver
to run only the web process)
- Client-side (javascript): Set up the environment and run
npm test
. You can also runnpm run test-coverage
to produce a somewhat-accurate coverage report for those tests. - Server-side (python): Set up the environment (no live server need run though
database and elasticsearch probably do need to be running), and run
python manage.py test
##Notes
- When modifying content in the database, run
python manage.py recreate_index
to update the content in ElasticSearch. - The CONTENT_PREPROCESSORS setting in settings.py specifies functions that are executed whenever a Content object is saved or updated. This is used to process the content and add addition information to the Content object (such as readability scores, tags, etc.).
npm run build-prod
to build the bundle for the web app.