예제 #1
0
파일: cli.py 프로젝트: danellis/dextrose
 def run(self, args):
     from IPython.Shell import IPShellEmbed
     from werkzeug import Client, EnvironBuilder
     from dextrose.context import Context
     from dextrose.http import Response
     app = load_application(args.package, args.environment)
     environ_builder = EnvironBuilder()
     environ = environ_builder.get_environ()
     request = environ_builder.get_request()
     client = Client(app, Response)
     with Context(app, environ, request, {}) as context:
         banner = "Dextrose IPython shell\n%s" % args.package
         shell = IPShellEmbed(
             banner=banner,
             argv=[
                 '-prompt_in1',
                 '%s> ' % args.package, '-prompt_in2',
                 '%s... ' % (' ' * (len(args.package) - 3)), '-prompt_out',
                 '=> '
             ])
         shell(global_ns={},
               local_ns={
                   'app': app,
                   'environ': environ,
                   'client': client,
                   'context': context
               })
예제 #2
0
파일: cli.py 프로젝트: danellis/dextrose
 def run(self, args):
     from werkzeug.serving import run_simple
     app = load_application(args.package, args.environment)
     wsgi = app.wsgi
     for middleware in app.config['middleware']:
         factory = import_string(middleware)
         wsgi = factory(app, wsgi)
     compiler = StaticFileCompiler([SassCompiler, CoffeeScriptCompiler])
     static_files = compiler.compile_all(os.path.join(app.directory, 'static'))
     run_simple(
         'localhost', 5000, wsgi,
         use_reloader=args.reloader, use_debugger=True, use_evalex=True,
         threaded=False, processes=1, extra_files=static_files
     )
예제 #3
0
파일: cli.py 프로젝트: danellis/dextrose
 def run(self, args):
     from werkzeug.serving import run_simple
     app = load_application(args.package, args.environment)
     wsgi = app.wsgi
     for middleware in app.config['middleware']:
         factory = import_string(middleware)
         wsgi = factory(app, wsgi)
     compiler = StaticFileCompiler([SassCompiler, CoffeeScriptCompiler])
     static_files = compiler.compile_all(
         os.path.join(app.directory, 'static'))
     run_simple('localhost',
                5000,
                wsgi,
                use_reloader=args.reloader,
                use_debugger=True,
                use_evalex=True,
                threaded=False,
                processes=1,
                extra_files=static_files)
예제 #4
0
파일: cli.py 프로젝트: danellis/dextrose
 def run(self, args):
     from IPython.Shell import IPShellEmbed
     from werkzeug import Client, EnvironBuilder
     from dextrose.context import Context
     from dextrose.http import Response
     app = load_application(args.package, args.environment)
     environ_builder = EnvironBuilder()
     environ = environ_builder.get_environ()
     request = environ_builder.get_request()
     client = Client(app, Response)
     with Context(app, environ, request, {}) as context:
         banner="Dextrose IPython shell\n%s" % args.package
         shell = IPShellEmbed(banner=banner, argv=[
             '-prompt_in1', '%s> ' % args.package,
             '-prompt_in2', '%s... ' % (' ' * (len(args.package) - 3)),
             '-prompt_out', '=> '
         ])
         shell(global_ns={}, local_ns={
             'app': app,
             'environ': environ,
             'client': client,
             'context': context
         })
예제 #5
0
def application(environ, start_response):
    app_package = environ['dx.application']
    environment = environ['dx.environment']
    application = load_application(app_package, environment)
    return application.wsgi(environ, start_response)