# Path: poweredsites/libs/utils.py
# def parse_config_file(path):
#     """Rewrite tornado default parse_config_file.
#     
#     Parses and loads the Python config file at the given path.
#     
#     This version allow customize new options which are not defined before
#     from a configuration file.
#     """
#     config = {}
#     execfile(path, config, config)
#     for name in config:
#         if name in options:
#             options[name].set(config[name])
#         else:
#             define(name, config[name])


import os
import tornado
    import poweredsites
    import sys
from tornado import web
from tornado.ioloop import IOLoop
from tornado.httpserver import HTTPServer
from tornado.options import options
from poweredsites.libs.utils import parse_config_file
        from poweredsites.urls import handlers, sub_handlers, ui_modules
            xsrf_cookies=options.xsrf_cookies,
            cookie_secret=options.cookie_secret,
            login_url=options.login_url,
            static_url_prefix=options.static_url_prefix,

            ui_modules=ui_modules,

            # auth secret
            twitter_consumer_key=options.twitter_consumer_key,
            twitter_consumer_secret=options.twitter_consumer_secret,
            friendfeed_consumer_key=options.friendfeed_consumer_key,
            friendfeed_consumer_secret=options.friendfeed_consumer_secret,
            facebook_api_key=options.facebook_api_key,
            facebook_secret=options.facebook_secret,
        )
        super(Application, self).__init__(handlers, **settings)

        # add handlers for sub domains
        for sub_handler in sub_handlers:
            # host pattern and handlers
            self.add_handlers(sub_handler[0], sub_handler[1])

def main():
    parse_config_file("/mnt/ebs/conf/sites/poweredsites.conf")
    tornado.options.parse_command_line()

    http_server = HTTPServer(Application(), xheaders=True)
    port = options.port
    num_processes = options.num_processes


# Path: poweredsites/libs/utils.py
# def parse_config_file(path):
#     """Rewrite tornado default parse_config_file.
#     
#     Parses and loads the Python config file at the given path.
#     
#     This version allow customize new options which are not defined before
#     from a configuration file.
#     """
#     config = {}
#     execfile(path, config, config)
#     for name in config:
#         if name in options:
#             options[name].set(config[name])
#         else:
#             define(name, config[name])


# Path: poweredsites/app.py
import os
import tornado
    import poweredsites
    import sys
from tornado import web
from tornado.ioloop import IOLoop
from tornado.httpserver import HTTPServer
from tornado.options import options
from poweredsites.libs.utils import parse_config_file
        from poweredsites.urls import handlers, sub_handlers, ui_modules

            xsrf_cookies=options.xsrf_cookies,
            cookie_secret=options.cookie_secret,
            login_url=options.login_url,
            static_url_prefix=options.static_url_prefix,

            ui_modules=ui_modules,

            # auth secret
            twitter_consumer_key=options.twitter_consumer_key,
            twitter_consumer_secret=options.twitter_consumer_secret,
            friendfeed_consumer_key=options.friendfeed_consumer_key,
            friendfeed_consumer_secret=options.friendfeed_consumer_secret,
            facebook_api_key=options.facebook_api_key,
            facebook_secret=options.facebook_secret,
        )
        super(Application, self).__init__(handlers, **settings)

        # add handlers for sub domains
        for sub_handler in sub_handlers:
            # host pattern and handlers
            self.add_handlers(sub_handler[0], sub_handler[1])

def main():
    parse_config_file("/mnt/ebs/conf/sites/poweredsites.conf")
    tornado.options.parse_command_line()

    http_server = HTTPServer(Application(), xheaders=True)
    port = options.port
    num_processes = options.num_processes


    if options.debug: