PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tmp/examples/dynamicweb/server.py

https://bitbucket.org/prologic/circuits/
Python | 24 lines | 16 code | 7 blank | 1 comment | 2 complexity | 275ac9c0472779b40e4443631641b910 MD5 | raw file
 1#!/usr/bin/env python
 2
 3from circuits import Loader
 4from circuits.web import Server, Controller, Logger
 5
 6class Root(Controller):
 7
 8    loader = Loader(paths=["./plugins"])
 9
10    def index(self):
11        return "Hello World!"
12
13    def load(self, name):
14        try:
15            result = self.loader.load(name)
16            if result is not None:
17                return "Successfully loaded %s" % name
18            else:
19                return "Failed to find %s" % name
20        except:
21            return "Failed to load %s" % name
22
23
24(Server(("0.0.0.0", 8000)) + Root() + Logger()).run()