Skip to content

Demo of django and couchdb with endpoints for creating and viewing papers

Notifications You must be signed in to change notification settings

cristianprice/django-couchdb-demo

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ICML Django + Couch Example

By James Ravenscroft

Installation

First make sure you have Apache CouchDB running on your system or another machine. The file icml/settings.py has a COUCHDB_SERVER value which is used to point Django to the correct location if it isn't installed locally.

Run the following code to install and run the django server:

pip install -r requirements.txt
python manage.py migrate
python manage.py runserver

Usage

Use something like Postman to test the API endpoints.

POST /papers/create

You can post a JSON object to this URL to create a paper in Couchdb:

{
  "title" : "Latent Dirichlet Allocation",
  "abstract" : "We describe latent Dirichlet allocation (LDA), a generative...",
  "type" : "journal"
}

The response will be a carbon copy of your input data plus the relevant ID

{
  "id": "ba5379605c18a29368f7ec6dcb0022e0",
  "title" : "Latent Dirichlet Allocation",
  "abstract" : "We describe latent Dirichlet allocation (LDA), a generative...",
  "type" : "journal"
}

GET /papers/

Given an ID, return JSON representation of that paper from CouchDB.

GET /papers/ba5379605c18a29368f7ec6dcb0022e0

...

{
  "id": "ba5379605c18a29368f7ec6dcb0022e0",
  "title" : "Latent Dirichlet Allocation",
  "abstract" : "We describe latent Dirichlet allocation (LDA), a generative...",
  "type" : "journal"
}

About

Demo of django and couchdb with endpoints for creating and viewing papers

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%