tags:

views:

93

answers:

1

Hi, I'm a newb to this. I've seen the code snippet at the official site (pasted below). The problem is how do I deploy this to the server ? Where do I set the username and password credentials ? In the httpd.conf file for Apache ?


from django.conf.urls.defaults import *
from piston.resource import Resource
from piston.authentication import HttpBasicAuthentication

from myapp.handlers import BlogPostHandler, ArbitraryDataHandler

auth = HttpBasicAuthentication(realm="My Realm")
ad = { 'authentication': auth }

blogpost_resource = Resource(handler=BlogPostHandler, **ad)
arbitrary_resource = Resource(handler=ArbitraryDataHandler, **ad)

urlpatterns += patterns('',
    url(r'^posts/(?P<post_slug>[^/]+)/$', blogpost_resource), 
    url(r'^other/(?P<username>[^/]+)/(?P<data>.+)/$', arbitrary_resource), 
)
A: 

By default piston.authenticate.HttpBasicAuthentication uses django.contrib.auth.authenticate to check credentials.

In other words: you "set username and password credentials" simply by creating normal Django Users.

hop