This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Use PopIt stored data in your Django app

Project Description
PopIt Django App

|Build Status|

A Django app that makes it easy to locally store and use data from one
or more PopIt API instances.

What is PopIt and PopIt-API?

PopIt is a project from `mySociety <>`__ that
aims to make it really simple to store and share data on people such as
politicians, organisations such as parliaments and political parties,
and the posts and memberships that link the people to the organisations.

The PopIt-API is a self standing server that provides a HTTP REST API to
read and write this data. It is a `separate
codebase <>`__ to this one.

This Django app lets you fetch data from several PopIt-APIs and store it
locally in your Django project so that you can use all the power of the
Django ORM to query the data. There are also management commands that
make it easy to fetch the latest updates from the PopIt-API.

It will also let you store your own data in the same models so that you
can add to the data from the PopIt-APIs. In time it should be possible
to push this local data out to a PopIt-API so that it is easy for others
to reuse.

WARNING - Alpha code

This is alpha code and subject to frequent and backwards incompatible
change. Feel free to experiment but do not use in production until this
message is removed.

This code is a work in progress - it is probably not useful to you yet.
Please see the ```` file for possible future additions and the
issues <>`__
for more immediately planned work.

Installing and configuring

Please install ``popit-django`` from PyPI. You should also add it to
your project's ``requirements.txt``.

.. code:: bash

pip install popit-django --use-mirrors

In your ```` add ``south`` and ``popit`` to your
``INSTALLED_APPS`` (``popit`` uses South to manage database migrations
so make sure it comes first).

.. code:: python

# ...
# ....

Setup the database:

.. code:: bash

python syncdb
python migrate

Now create a ``popit.models.ApiInstance`` entry and fetch all the
documents from that API instance:

.. code:: bash

python popit_retrieve_all

Database notes

For some of the referential integrity we use a ``UNIQUE INDEX`` to
prevent duplicates on values that are ``NOT NULL``. This is known to
work with Postgres and SQLite, but other databases may have issues. See
the ``PopItURLField`` class in ``popit/`` for more details.


If you want to contribute to the development of ``popit-django`` that
would be great, we aim to be responsive to pull requests. These
instructions should get you a dev environment set up.

To run the tests you'll need a local PopIt-API instance that can be
deleted. This will be installed for you by the
``start_local_popit_api.bash`` script, but it requires the following:

- `MongoDB <>`__ for the PopIt-API instance.
allow anonymous access and db creation (the default).
- `Node.js <>`__ installed.

.. code:: bash

# get the code (you might want to clone your fork instead)
git clone
cd popit-django

# Set up virtual environment
virtualenv --no-site-packages .venv
. .venv/bin/activate

# Install the python dependencies
pip install -r requirements.txt --use-mirrors

# Install (if needed) and start the popit-api server

# Run the tests
./ test popit

.. |Build Status| image::
Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
popit-django-0.0.3.tar.gz (28.4 kB) Copy SHA256 Checksum SHA256 Source Apr 10, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting