- Install the app.
$ pip install django-politico-civic-almanac
- Add the app to your Django project and configure settings.
INSTALLED_APPS = [
# ...
'rest_framework',
'almanac',
]
#########################
# almanac settings
ALMANAC_SECRET_KEY = ''
ALMANAC_AWS_ACCESS_KEY_ID = ''
ALMANAC_AWS_SECRET_ACCESS_KEY = ''
ALMANAC_AWS_REGION = ''
ALMANAC_AWS_S3_BUCKET = ''
ALMANAC_CLOUDFRONT_ALTERNATE_DOMAIN = ''
ALMANAC_S3_UPLOAD_ROOT = ''
- Run the make command to setup a fresh database.
$ make database
- Add a connection URL to the
example/.env
file.
DATABASE_URL="postgres://localhost:5432/almanac"
(note, in order to access bootstrapping, you will need an API key to the Propublica Congress API in your example/.env
file as well.)
PROPUBLICA_CONGRESS_API_KEY=apikey
- Install Python requirements
$ cd example
$ pipenv install
- Run migrations from the example app.
$ cd example
$ pipenv run python manage.py migrate
- Bootstrap your database with initial data.
$ pipenv run python manage.py bootstrap_almanac
- Bootstrap the election events
$ pipenv run python manage.py bootstrap_election_events
Developing python files? Move into example directory and run the development server with pipenv.
$ cd example
$ pipenv run python manage.py runserver
Developing static assets? Move into the pluggable app's staticapp directory and start the node development server, which will automatically proxy Django's development server.
$ cd almanac/staticapp
$ yarn install
$ gulp
Want to not worry about it? Use the shortcut make command.
$ make dev