Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

XForms processing engine in django and couchdb

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 couchforms
Octocat-spinner-32 .coveragerc
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 MANIFEST.in
Octocat-spinner-32 README.md
Octocat-spinner-32 settings.py
Octocat-spinner-32 setup.py
README.md

Couchforms

Build Status Test coverage PyPi version PyPi downloads

Put XForms in couchdb!

To run the tests, pip install -e . && django-admin.py test --settings settings

To include this in a django project you need the following settings defined in your settings.py

####### Couch Forms & Couch DB Kit Settings #######

COUCH_SERVER_ROOT = 'localhost:5984'
COUCH_USERNAME = ''
COUCH_PASSWORD = ''
COUCH_DATABASE_NAME = 'database_name'

# you may want to import localsettings here so the variables above can be overridden

def get_server_url(server_root, username, password):
    if username and password:
        return "http://%(user)s:%(pass)s@%(server)s" % \
            {"user": username,
             "pass": password,
             "server": server_root }
    else:
        return "http://%(server)s" % {"server": server_root }
COUCH_SERVER = get_server_url(COUCH_SERVER_ROOT, COUCH_USERNAME, COUCH_PASSWORD)
COUCH_DATABASE = "%(server)s/%(database)s" % {"server": COUCH_SERVER, "database": COUCH_DATABASE_NAME }


COUCHDB_DATABASES = [(app_label, COUCH_DATABASE) for app_label in [
        'couchforms',
    ]
]

In order to put up a couchforms url that can receive POSTs, add the following line to urls.py:

#   ...
    (r'desired/url/$',  'couchforms.views.post'),
#   ...

In order to test whether this is working, you can send a filled out xform submission (saved at ./sub.xml) for the command line with curl as follows:

$ curl -X POST http://localhost:8000/desired/url/ -d @sub.xml
Something went wrong with that request. Please try again.