我是新手。我在官方网站上看到了代码片段(粘贴在下面)。问题是如何将其部署到服务器?我在哪里设置用户名和密码凭据?在 Apache 的 httpd.conf 文件中?
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),
)