usr bin env python import tornado ioloop import tornado web import mot

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/env python
import tornado.ioloop
import tornado.web
import motor
from motor.web import GridFSHandler
import sys
db = motor.MotorClient().open_sync().DB_NAME
application = tornado.web.Application([
(
r"\/(?P<path>[^\/]+)",
GridFSHandler,
{"database": db, "root_collection": 'Files'}
),
])
if __name__ == "__main__":
application.listen(sys.argv[1])
tornado.ioloop.IOLoop.instance().start()