]>
git.frykholm.com Git - butterbackup.git/blob - server.py
eb191e2de56e16ed1ef02890a6a866d44879ed9b
6 class MainHandler(tornado
.web
.RequestHandler
):
8 base_path
="/mnt/data2/"
9 fp
= os
.path
.join(base_path
, path
)
10 if not os
.path
.exists(fp
):
11 return self
.write("Not found")
13 items
= os
.listdir(fp
)
16 if os
.path
.isdir(os
.path
.join(fp
,item
)):
19 self
.render("dir.html",items
=items2
, title
=path
)
21 self
.set_header("Content-Type", "binary/octet-stream")
22 self
.write(open(fp
,"rb").read())
24 application
= tornado
.web
.Application([
25 (r
"/(.*)", MainHandler
),
28 if __name__
== "__main__":
29 application
.listen(1234)
30 tornado
.ioloop
.IOLoop
.instance().start()