Imported Upstream version 12.1.0
[contrib/python-twisted.git] / doc / web / examples / users.rpy.py
1 # Copyright (c) Twisted Matrix Laboratories.
2 # See LICENSE for details.
3
4 """
5 An example showing how to use a distributed web server's user directory support.
6
7 With this, you can have an instant "community web site",
8 letting your shell users publish data in secure ways.
9
10 Just put this script anywhere, and /path/to/this/script/<user>/ will publish a
11 user's ~/public_html, and a .../<user>.twistd/ will attempt to contact a user's
12 personal web server.
13
14 For example, if you put this at /var/www/users.rpy and run a server like:
15     $ twistd -n web --allow-ignore-ext --path /var/www
16
17 Then http://example.com/users/<name>/ and http://example.com/users/<name>.twistd
18 will work similarily to how they work on twistedmatrix.com.
19 """
20
21 from twisted.web import distrib
22
23 resource = distrib.UserDirectory()
24 registry.setComponent(distrib.UserDirectory, resource)