equal
deleted
inserted
replaced
55 ('loglevel', |
55 ('loglevel', |
56 {'short': 'l', 'type': 'choice', 'metavar': '<log level>', |
56 {'short': 'l', 'type': 'choice', 'metavar': '<log level>', |
57 'default': None, 'choices': ('debug', 'info', 'warning', 'error'), |
57 'default': None, 'choices': ('debug', 'info', 'warning', 'error'), |
58 'help': 'debug if -D is set, error otherwise', |
58 'help': 'debug if -D is set, error otherwise', |
59 }), |
59 }), |
|
60 ('profile', |
|
61 {'short': 'p', 'action': 'store_true', |
|
62 'default': False, |
|
63 'help': 'Enable profiling'}), |
|
64 ('profile-output', |
|
65 {'type': 'string', |
|
66 'default': None, |
|
67 'help': 'Profiling output file (default: "program.prof")'}), |
|
68 ('profile-dump-every', |
|
69 {'type': 'int', |
|
70 'default': None, |
|
71 'metavar': 'N', |
|
72 'help': 'Dump profile stats to ouput every N requests ' |
|
73 '(default: 100)'}), |
60 ) |
74 ) |
61 |
75 |
62 _reloader_environ_key = 'CW_RELOADER_SHOULD_RUN' |
76 _reloader_environ_key = 'CW_RELOADER_SHOULD_RUN' |
63 _reloader_filelist_environ_key = 'CW_RELOADER_FILELIST' |
77 _reloader_filelist_environ_key = 'CW_RELOADER_FILELIST' |
64 |
78 |
283 init_cmdline_log_threshold(cwconfig, self['loglevel']) |
297 init_cmdline_log_threshold(cwconfig, self['loglevel']) |
284 |
298 |
285 host = cwconfig['interface'] |
299 host = cwconfig['interface'] |
286 port = cwconfig['port'] or 8080 |
300 port = cwconfig['port'] or 8080 |
287 |
301 |
288 app = wsgi_application_from_cwconfig(cwconfig) |
302 app = wsgi_application_from_cwconfig( |
|
303 cwconfig, profile=self['profile'], |
|
304 profile_output=self['profile-output'], |
|
305 profile_dump_every=self['profile-dump-every'] |
|
306 ) |
289 |
307 |
290 repo = cwconfig.repository() |
308 repo = cwconfig.repository() |
291 try: |
309 try: |
292 repo.start_looping_tasks() |
310 repo.start_looping_tasks() |
293 waitress.serve(app, host=host, port=port) |
311 waitress.serve(app, host=host, port=port) |