Skip to content

judywawira/couchforms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Put XForms in couchdb!

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 }


XFORMS_POST_URL = "http://%s/%s/_design/couchforms/_update/xform/" % (COUCH_SERVER_ROOT, COUCH_DATABASE_NAME)
COUCHDB_DATABASES = [(app_label, COUCH_DATABASE) for app_label in [
        'couchforms',
    ]
]


### end settings.py ###

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

About

XForms processing engine in django and couchdb

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published