<s> import logging <EOL> import os <EOL> from tornado . options import parse_command_line , options , define <EOL> def parse_config_file ( path ) : <EOL> """<STR_LIT>""" <EOL> config = { } <EOL> execfile ( path , config , config ) <EOL> for name in config : <EOL> if name in options : <EOL> options [ name ] . set ( config [ name ] ) <EOL> else : <EOL> define ( name , config [ name ] ) <EOL> def parse_options ( ) : <EOL> _root = os . path . join ( os . path . dirname ( os . path . abspath ( __file__ ) ) , "<STR_LIT:..>" ) <EOL> _settings = os . path . join ( _root , "<STR_LIT>" ) <EOL> _settings_local = os . path . join ( _root , "<STR_LIT>" ) <EOL> try : <EOL> parse_config_file ( _settings ) <EOL> logging . info ( "<STR_LIT>" ) <EOL> except Exception , e : <EOL> logging . error ( "<STR_LIT>" % e ) <EOL> try : <EOL> parse_config_file ( _settings_local ) <EOL> logging . info ( "<STR_LIT>" ) <EOL> except Exception , e : <EOL> logging . error ( "<STR_LIT>" % e ) <EOL> parse_command_line ( ) </s>
