]>
Commit | Line | Data |
---|---|---|
81675874 | 1 | #!/usr/bin/python2.6 |
2 | ||
feb02477 MT |
3 | import daemon |
4 | import logging | |
5 | import logging.handlers | |
6 | import os | |
7 | import signal | |
8 | import sys | |
9 | ||
940227cb MT |
10 | #import tornado.httpserver |
11 | #import tornado.ioloop | |
feb02477 | 12 | import tornado.options |
81675874 | 13 | |
14 | from webapp import Application | |
feb02477 | 15 | |
81675874 | 16 | if __name__ == "__main__": |
feb02477 MT |
17 | app = Application() |
18 | ||
19 | context = daemon.DaemonContext( | |
20 | working_directory=os.getcwd(), | |
940227cb | 21 | # stdout=sys.stdout, stderr=sys.stderr, # XXX causes errors... |
feb02477 | 22 | ) |
3add293a | 23 | |
feb02477 MT |
24 | context.signal_map = { |
25 | signal.SIGHUP : app.reload, | |
940227cb | 26 | signal.SIGTERM : app.shutdown, |
feb02477 | 27 | } |
3add293a | 28 | |
940227cb MT |
29 | # with context: |
30 | # app.run() | |
31 | ||
32 | app.run() |