コード例 #1
0
ファイル: server.py プロジェクト: Squarespace/cubes
    def setUp(self):
        super(SlicerTestCaseBase, self).setUp()

        self.slicer = create_server()
        self.slicer.debug = True
        self.server = Client(self.slicer, BaseResponse)
        self.logger = self.slicer.logger
        self.logger.setLevel("DEBUG")
コード例 #2
0
    def setUp(self):
        super(SlicerTestCaseBase, self).setUp()

        self.slicer = create_server()
        self.slicer.debug = True
        self.server = Client(self.slicer, BaseResponse)
        self.logger = self.slicer.logger
        self.logger.setLevel("DEBUG")
コード例 #3
0
ファイル: wsgi.py プロジェクト: Lardeva/ostrova
with open (BASE_DIR + "/ostrovacubes/heroku_slicer.ini", 'r') as inp,\
     open (BASE_DIR + "/ostrovacubes/heroku_slicer_subst.ini", 'w+') as temp :
    for ln in inp:
        temp.write(os.path.expandvars(ln))

os.environ.setdefault("SLICER_CONFIG",
                      BASE_DIR + "/ostrovacubes/heroku_slicer_subst.ini")

django_application = get_wsgi_application()
django_application = DjangoWhiteNoise(django_application)

config = read_slicer_config(os.environ["SLICER_CONFIG"])

logging.error("init cubes")

# initialize logging
#if config.has_option("server","log"):
logging.error("init logging:" +
              config.get("server", "log", fallback="CONSOLE"))
lg = get_logger(config.get("server", "log", fallback=None))
lg.error("logging test")
lg.setLevel(logging.DEBUG)

cubes_application = create_server(config)

debug = os.environ.get("SLICER_DEBUG")
if debug and str_to_bool(debug):
    cubes_application.debug = True

application = DispatcherMiddleware(django_application,
                                   {'/cubes_backend': cubes_application})
コード例 #4
0
import os.path
from cubes.server import create_server

CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))

# Set the configuration file name (and possibly whole path) here
CONFIG_PATH = os.path.join(CURRENT_DIR, "slicer.ini")

application = create_server(CONFIG_PATH)
コード例 #5
0
ファイル: setup.py プロジェクト: zelima/cg-cubes
        return ConfigParser()
    elif isinstance(config, basestring):
        try:
            path = config
            config = ConfigParser()
            config.read(path)
        except Exception as e:
            raise Exception("Unable to load configuration: %s" % e)
    return config


def setup_config(config):
    config = read_slicer_config(config)

    # set server configurations: port
    config.set("server", "port", os.environ.get('PORT') or '5000')

    # set store configurations
    config.add_section('store')
    config.set("store", "type", "sql")
    if os.environ.get('CG_URL'):
        config.set("store", "url", os.environ.get('CG_URL'))
    else:
        raise Exception(
            "No Database URL found. Please export CG_URL=postress://etc...")
    return config


config = setup_config('slicer.ini')
application = server.create_server(config)