OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/env python | |
2 # Copyright 2014 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 import argparse | |
7 import os | |
8 import cherrypy | |
9 | |
10 BUILD_DIRECTORY = 'out' | |
11 CONFIG_DIRECTORY = 'Debug' | |
esprehn
2014/10/28 19:38:07
This means this can't work for Release? I think ab
| |
12 GEN_DIRECTORY = os.path.abspath(os.path.join(__file__, os.pardir, os.pardir, | |
13 os.pardir, BUILD_DIRECTORY, CONFIG_DIRECTORY, 'gen')) | |
14 | |
15 # FIXME: This doesn't yet support directory listings. We'll do something like: | |
16 # http://tools.cherrypy.org/wiki/staticdirindex | |
17 # but have it spit .sky instead of HTML | |
18 | |
19 def main(): | |
20 parser = argparse.ArgumentParser(description='Sky development server') | |
21 parser.add_argument('app_path', type=str) | |
22 parser.add_argument('port', type=int) | |
23 args = parser.parse_args() | |
24 | |
25 config = { | |
26 'global': { | |
27 'server.socket_port': args.port, | |
28 }, | |
29 '/': { | |
30 'tools.staticdir.on': True, | |
31 'tools.staticdir.dir': os.path.abspath(args.app_path), | |
32 }, | |
33 '/sky': { | |
34 'tools.staticdir.on': True, | |
35 'tools.staticdir.dir': os.path.join(GEN_DIRECTORY, 'sky'), | |
36 }, | |
37 '/mojo': { | |
38 'tools.staticdir.on': True, | |
39 'tools.staticdir.dir': os.path.join(GEN_DIRECTORY, 'mojo'), | |
40 } | |
41 } | |
42 cherrypy.quickstart(config=config) | |
43 | |
44 | |
45 if __name__ == '__main__': | |
46 main() | |
OLD | NEW |