Mercurial > code > home > repos > light9
annotate bin/subserver @ 942:dd896321faee
subserver can get a snapshot from vidref and display it on the sub
Ignore-this: 9ea0a172869922d22d8c5cf6ee4bf3da
author | drewp@bigasterisk.com |
---|---|
date | Thu, 13 Jun 2013 01:31:16 +0000 |
parents | 8b95d2865643 |
children | 891f2d75c686 |
rev | line source |
---|---|
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
1 #!bin/python |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
2 """ |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
3 live web display of all existing subs with pictures, mainly for |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
4 dragging them into CC |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
5 """ |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
6 from run_local import log |
942
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
7 import sys, optparse, logging, json, subprocess, datetime |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
8 from dateutil.tz import tzlocal |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
9 from twisted.internet import reactor, defer |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
10 import cyclone.web, cyclone.httpclient, cyclone.websocket |
942
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
11 from rdflib import RDF, URIRef, Literal |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
12 import pyjade.utils |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
13 from light9.rdfdb.syncedgraph import SyncedGraph |
942
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
14 from light9.rdfdb.patch import Patch |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
15 from light9.namespaces import L9, DCTERMS |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
16 from light9 import networking, showconfig |
222 | 17 |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
18 try: |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
19 sys.path.append("../homeauto/lib") |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
20 sys.path.append("/home/drewp/projects/homeauto/lib") |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
21 from cycloneerr import PrettyErrorHandler |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
22 except ImportError: |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
23 class PrettyErrorHandler(object): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
24 pass |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
25 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
26 liveClients = set() |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
27 def sendToLiveClients(d=None, asJson=None): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
28 j = asJson or json.dumps(d) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
29 for c in liveClients: |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
30 c.sendMessage(j) |
222 | 31 |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
32 class Live(cyclone.websocket.WebSocketHandler): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
33 def connectionMade(self, *args, **kwargs): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
34 log.info("websocket opened") |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
35 liveClients.add(self) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
36 self.settings.onNewClient() |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
37 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
38 def connectionLost(self, reason): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
39 log.info("websocket closed") |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
40 liveClients.remove(self) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
41 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
42 def messageReceived(self, message): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
43 log.info("got message %s" % message) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
44 self.sendMessage(message) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
45 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
46 class Static(PrettyErrorHandler, cyclone.web.StaticFileHandler): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
47 def get(self, path, *args, **kw): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
48 if path == '': |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
49 return self.respondStaticJade("light9/subserver/index.jade") |
222 | 50 |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
51 if path == 'gui.js': |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
52 return self.responseStaticCoffee('light9/subserver/gui.coffee') |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
53 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
54 oddlyPlaced = { |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
55 "websocket.js": "light9/rdfdb/web/websocket.js", |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
56 "jquery-1.7.2.min.js": "light9/rdfdb/web/lib/jquery-1.7.2.min.js", |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
57 } |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
58 if path in oddlyPlaced: |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
59 self.write(open(oddlyPlaced[path]).read()) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
60 return |
310
6a4e99505164
subserver still in progress
Drew Perttula <drewp@bigasterisk.com>
parents:
222
diff
changeset
|
61 |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
62 cyclone.web.StaticFileHandler.get(self, path, *args, **kw) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
63 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
64 def respondStaticJade(self, src): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
65 html = pyjade.utils.process(open(src).read()) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
66 self.write(html) |
222 | 67 |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
68 def responseStaticCoffee(self, src): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
69 self.write(subprocess.check_output([ |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
70 '/usr/bin/coffee', '--compile', '--print', src])) |
942
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
71 |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
72 class Snapshot(PrettyErrorHandler, cyclone.web.RequestHandler): |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
73 @defer.inlineCallbacks |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
74 def post(self): |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
75 about = URIRef(self.get_argument("about")) |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
76 response = yield cyclone.httpclient.fetch(networking.vidref.path("snapshot"), method="POST") |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
77 |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
78 snapUri = URIRef(json.loads(response.body)['snapshot']) |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
79 # vidref could write about when it was taken, etc. would it be |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
80 # better for us to tell vidref where to attach the result in |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
81 # the graph, and then it doesn't even have to return anything? |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
82 |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
83 ctx = showconfig.showUri() + "/snapshots" |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
84 |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
85 self.settings.graph.patch(Patch(addQuads=[ |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
86 (about, L9['image'], snapUri, ctx), |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
87 (snapUri, DCTERMS['created'], |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
88 Literal(datetime.datetime.now(tzlocal())), ctx), |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
89 ])) |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
90 |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
91 self.write(json.dumps({'snapshot': snapUri})) |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
92 |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
93 def newestImage(subject): |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
94 newest = (None, None) |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
95 for img in graph.objects(subject, L9['image']): |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
96 created = graph.value(img, DCTERMS['created']) |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
97 if created > newest[0]: |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
98 newest = (created, img) |
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
99 return newest[1] |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
100 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
101 if __name__ == "__main__": |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
102 parser = optparse.OptionParser() |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
103 parser.add_option("-v", "--verbose", action="store_true", |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
104 help="logging.DEBUG") |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
105 (options, args) = parser.parse_args() |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
106 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
107 log.setLevel(logging.DEBUG if options.verbose else logging.INFO) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
108 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
109 graph = SyncedGraph("subserver") |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
110 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
111 d = {} |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
112 def updateSubs(): |
923
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
113 subs = [] |
942
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
114 for sub in sorted(graph.subjects(RDF.type, L9['Submaster'])): |
923
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
115 rec = {'uri' : sub} |
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
116 rec['isLocal'] = graph.contains((sub, RDF.type, |
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
117 L9['LocalSubmaster'])) |
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
118 rec['label'] = graph.label(sub) |
942
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
119 rec['img'] = newestImage(sub) |
923
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
120 subs.append(rec) |
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
121 |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
122 d.clear() |
923
8b95d2865643
subserver shows real submasters, stays live. pretty sweet
drewp@bigasterisk.com
parents:
919
diff
changeset
|
123 d.update({'subs': subs}) |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
124 sendToLiveClients(d=d) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
125 def onNewClient(): |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
126 sendToLiveClients(d=d) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
127 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
128 graph.addHandler(updateSubs) |
222 | 129 |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
130 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
131 port = 8052 |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
132 reactor.listenTCP(port, cyclone.web.Application(handlers=[ |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
133 (r'/live', Live), |
942
dd896321faee
subserver can get a snapshot from vidref and display it on the sub
drewp@bigasterisk.com
parents:
923
diff
changeset
|
134 (r'/snapshot', Snapshot), |
919
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
135 (r'/(.*)', Static, |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
136 {"path" : "light9/subserver", |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
137 "default_filename" : "index.jade"}), |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
138 ], debug=True, graph=graph, onNewClient=onNewClient)) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
139 log.info("serving on %s" % port) |
33a5a98e9bf1
start subserver webapp with websockets, cyclone, jade, coffee
drewp@bigasterisk.com
parents:
310
diff
changeset
|
140 reactor.run() |