1. Justin Israel
  2. django-piston-oauth2-nonrel-example


I created this sample installation because I needed to create django REST service with piston on mongodb and oauth authentication.  I found it there were a number of bugs in piston, issues with django-nonrel, and few good examples of oauth authentication.  I spent a couple of days figuring this out.  Hopefully this will save you the time!

This an example installation of fully functional django-nonrel piston installation with oauth authentication and GET and POST examples for a basic Poll application.

* Note: This is still using an oath 1.0 client implementation, along with a piston oauth 1.0 service.

These are the installation instructions to get your django-piston-nonrel-oauth2 server up and running.

1.  Clone repository at 

2.  virtualenv piston-env

3.  source ./piston-env/bin/activate

4.  pip install -r requirements.txt

5.  cd frameworks ; Update your settings.py to point to your mongodb settings

6.  Run ./manage.py syncdb and create your superuser account

7.  Run ./manage.py runserver

8.  Go to localhost:8000/admin and login. Create a Consumer with the following settings:

Consumer Key: testkey
Consumer Secret: testsecret

The name and description can be anything you choose.  Attach the Consumer to your superuser or another use if you have created on.

9.  From a command line prompt run python oauth_client.py

10.  Follow the instructions for oauth_client.py

11.  For a two-legged test, run oauth_client.py two-legged

12.  To run the general test, do:  ./manage.py test oauth_tests

Hope this helps!