import os
import tornado.web
from tornado.options import define

from .handlers import LandingHandler, RequestHandler


class InteractApp(tornado.web.Application):
    """
    Entry point for the interact app.
    """
    def __init__(self, config=None):
        # Terrible hack to get config object in global namespace. This allows
        # us to use options.config to get the global config object.
        #
        # TODO(sam): Replace with a better solution
        define('config', config)

        base_url = config['URL']
        socket_url = config['URL'] + r'socket/(\w+)'

        handlers = [
            (base_url, LandingHandler),
            (socket_url, RequestHandler),
        ]

        settings = dict(
            debug=True,
            serve_traceback=True,
            compiled_template_cache=False,
            template_path=os.path.join(os.path.dirname(__file__), 'templates'),
            static_path=os.path.join(os.path.dirname(__file__), 'static'),

            # Ensure static urls are prefixed with the base url too
            static_url_prefix=config['URL'] + 'static',
        )

        super(InteractApp, self).__init__(handlers, **settings)

import os
import tornado.web
from tornado.options import define

from .handlers import LandingHandler, RequestHandler


class InteractApp(tornado.web.Application):
    """
    Entry point for the interact app.
    """
    def __init__(self, config=None):
        # Terrible hack to get config object in global namespace. This allows
        # us to use options.config to get the global config object.
        #
        # TODO(sam): Replace with a better solution
        define('config', config)

        # Assumes config['URL'] has a trailing slash
        base_url = config['URL'][:-1]
        socket_url = config['URL'] + r'socket/(\w+)'

        handlers = [
            (base_url, LandingHandler),
            (socket_url, RequestHandler),
        ]

        settings = dict(
            debug=True,
            serve_traceback=True,
            compiled_template_cache=False,
            template_path=os.path.join(os.path.dirname(__file__), 'templates'),
            static_path=os.path.join(os.path.dirname(__file__), 'static'),

            # Ensure static urls are prefixed with the base url too
            static_url_prefix=config['URL'] + 'static',
        )

        super(InteractApp, self).__init__(handlers, **settings)

Remove trailing slash from base_url
Remove trailing slash from base_url
