summaryrefslogtreecommitdiff
path: root/vendor/Twisted-10.0.0/doc/web/examples/silly-web.py
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/Twisted-10.0.0/doc/web/examples/silly-web.py')
-rw-r--r--vendor/Twisted-10.0.0/doc/web/examples/silly-web.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/Twisted-10.0.0/doc/web/examples/silly-web.py b/vendor/Twisted-10.0.0/doc/web/examples/silly-web.py
new file mode 100644
index 0000000000..b98d359bbc
--- /dev/null
+++ b/vendor/Twisted-10.0.0/doc/web/examples/silly-web.py
@@ -0,0 +1,18 @@
+# This shows an example of a bare-bones distributed web
+# set up.
+# The "master" and "slave" parts will usually be in different files
+# -- they are here together only for brevity of illustration
+
+from twisted.internet import reactor, protocol
+from twisted.web import server, distrib, static
+from twisted.spread import pb
+
+# The "master" server
+site = server.Site(distrib.ResourceSubscription('unix', '.rp'))
+reactor.listenTCP(19988, site)
+
+# The "slave" server
+fact = pb.PBServerFactory(distrib.ResourcePublisher(server.Site(static.File('static'))))
+
+reactor.listenUNIX('./.rp', fact)
+reactor.run()