This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django CBTools

Django CBTools is a wrapper around Couchbase python library plus several hook to Sync-Gateway API.

The document search is done using Couchbase library (directly) connection to couchbase server, but saving and retrieving of the document is done using Sync-Gateway HTTP API. This is done in order to have documents available for mobile clients, which can get all benefits of Couchbase library only through Sync-Gateway.

The essential part of the package is models. They are inherited from Django models with almost all the benefits they have: can be validated with Django forms and have fields all sort of field you are used to have.

Installation

Pre-requisite

  • working Couchbase server / cluster
  • working Sync-Gateway server

Requirements

  • couchbase==2.0.2
  • django-extensions==1.5.5
  • django-tastypie==0.12.2
  • requests==2.7.0
  • shortuuid==0.4.2

couchbase package installation can be tricky. A recipe for Ubuntu 12:

sudo wget -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1204.list
wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install libcouchbase-dev libcouchbase2-libevent

For Ubuntu 14:

sudo wget -O/etc/apt/sources.list.d/couchbase.list http://packages.couchbase.com/ubuntu/couchbase-ubuntu1404.list
wget -O- http://packages.couchbase.com/ubuntu/couchbase.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install libcouchbase-dev libcouchbase2-libevent

Quick Install

Install package:

pip install django-cbtools

The following configuration settings are used for the package (you can use the set below for the fast installation):

COUCHBASE_BUCKET = 'default'
COUCHBASE_HOSTS = ['127.0.0.1']
COUCHBASE_PASSWORD = None
SYNC_GATEWAY_BUCKET = 'default'
SYNC_GATEWAY_URL = 'http://127.0.0.1:4984'
SYNC_GATEWAY_ADMIN_URL = 'http://127.0.0.1:4985'
SYNC_GATEWAY_USER = "demo_admin"
SYNC_GATEWAY_PASSWORD = "demo_admin_password"
SYNC_GATEWAY_GUEST_USER = "demo_guest"
SYNC_GATEWAY_GUEST_PASSWORD = "demo_guest_password"

Add django_cbtools to INSTALLED_APPS:

INSTALLED_APPS = (
    # ...
    'django_cbtools',
)

Create folder couchbase_views in the project root.

Testing

You should create a testing couchbase bucket to run the package tests (and further your apps tests). For example default_test.

The testing bucket must contain test in the name. Otherwise some helper functions will raise exception.

Certianly SyncGateway configuration must also have to be configurated properly to take in account additional bucket, for example:

{
    "adminInterface":"0.0.0.0:4985",
    "databases": {
        "default": {
            "server": "http://127.0.0.1:8091",
            "bucket": "default"
        },
        "default_test": {
            "server": "http://127.0.0.1:8091",
            "bucket": "default_test"
        }
    }
}

Also you need an alternative settings.py to run tests. Probably you already have similar file to run your own tests. If you don’t it’s time to create it now. The following settings should be changed in order to run Couchbase-related tests properly:

  1. COUCHBASE_BUCKET is targetted to test bucket
  2. SYNC_GATEWAY_BUCKET is targetted to test bucket
  3. COUCHBASE_STALE is set to disable Couchbase caching

Like that, in file settings_test.py:

# ...
COUCHBASE_BUCKET = 'default_test'
COUCHBASE_STALE = False
SYNC_GATEWAY_BUCKET = 'default_test'
# ...

Now run tests as usual for django:

python manage.py test --settings=<your-project>.settings_test django_cbtools
Release History

Release History

1.2.0

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-cbtools-1.2.0.tar.gz (25.9 kB) Copy SHA256 Checksum SHA256 Source Apr 26, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development 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