This django app provides a basic user interface showing news and public post/membership history about public people. It also provides an API for retrieving the identity and post data about persons, and an interface for administrators to manage the person data.
Person data is in the Popolo standard. We get our baseline data from Peoples' Assembly, but we can correct it directly in this database.
On the server:
- uses dj-database-url for database URL injection
- uses django-pipeline for asset compilation and fingerprinting
- uses pyscss for compiling SCSS to CSS
- Bower to install assets
- better debugging with
python manage.py runserver_plus
from django-extensions - cookies for session storage
On the client:
- JQuery
- Google Analytics
- Bootstrap
- FontAwesome
Clone this git repository
Create a project python 2 virtual environment in the repository directory and activate it
Install python dependencies using pip install -r requirements.txt
Then, the first time you run the server, run migrations and create a superuser
python manage.py migrate
python manage.py createsuperuser
Update popolo data:
The first time, create the source
python manage.py popolo_sources_update --create https://www.pa.org.za/media_root/popolo_json/pombola.json
Subsequently, just update (without --create
)
python manage.py popolo_sources_update https://www.pa.org.za/media_root/popolo_json/pombola.json
Then you can run the server
python manage.py runserver
You can log in as your new superuser and explore the data using the admin interface at http://localhost:8000/admin and the public interface at http://localhost:8000/
- Put javascript into
code4sa/static/javascript/app.js
- Put SCSS stylesheets into
code4sa/static/stylesheets/app.scss
- Install new asset packs with Bower:
bower install -Sp package-to-install
- Get better debugging with
python manage.py runserver_plus
Production deployment is based on running the app on dokku
dokku apps:create publicpeople
dokku config:set DATABASE_URL=postgresql://.../publicpeople \
DJANGO_DEBUG=false \
DISABLE_COLLECTSTATIC=1 \
DJANGO_SECRET_KEY=some-secret-key \
NEW_RELIC_APP_NAME=cool app name \
NEW_RELIC_LICENSE_KEY=new relic license key
After pushing to the dokku git remote:
dokku run publicpeople python manage.py migrate
dokku run publicpeople python manage.py createsuperuser
git push dokku master
The first time, create the source
dokku run publicpeople python app/manage.py popolo_sources_update --create https://www.pa.org.za/media_root/popolo_json/pombola.json
Subsequently, just update (without --create
)
dokku run publicpeople python app/manage.py popolo_sources_update https://www.pa.org.za/media_root/popolo_json/pombola.json
The People API can be explored interactively at https://publicpeople.org.za/api/
An example query to the News API
MIT License
- Repo structure based on https://github.com/openupsa/django-template
- REST API based on https://github.com/openpolis/popolorest/blob/master/popolorest/views.py