コード例 #1
0
ファイル: app.py プロジェクト: shivkumar-k/jjb-frappe
def serve(port=8000, profile=False, site=None, sites_path='.'):
    global application, _site, _sites_path
    _site = site
    _sites_path = sites_path

    from werkzeug.serving import run_simple

    if profile:
        application = ProfilerMiddleware(application,
                                         sort_by=('tottime', 'calls'))

    if not os.environ.get('NO_STATICS'):
        application = SharedDataMiddleware(
            application, {
                b'/assets': os.path.join(sites_path, 'assets').encode("utf-8"),
            })

        application = StaticDataMiddleware(
            application,
            {b'/files': os.path.abspath(sites_path).encode("utf-8")})

    application.debug = True
    application.config = {'SERVER_NAME': 'localhost:8000'}

    run_simple('0.0.0.0',
               int(port),
               application,
               use_reloader=True,
               use_debugger=True,
               use_evalex=True,
               threaded=True)
コード例 #2
0
def serve(port=8000, profile=False, site=None, sites_path='.'):
    global application, _site, _sites_path
    _site = site
    _sites_path = sites_path

    from werkzeug.serving import run_simple

    if profile:
        application = ProfilerMiddleware(application,
                                         sort_by=('cumtime', 'calls'))

    if not os.environ.get('NO_STATICS'):
        application = SharedDataMiddleware(
            application, {
                '/assets': os.path.join(sites_path, 'assets'),
            })

        application = StaticDataMiddleware(
            application, {'/files': os.path.abspath(sites_path)})

    application.debug = True
    application.config = {'SERVER_NAME': 'localhost:8000'}

    in_test_env = os.environ.get('CI')
    if in_test_env:
        log = logging.getLogger('werkzeug')
        log.setLevel(logging.ERROR)

    run_simple('0.0.0.0',
               int(port),
               application,
               use_reloader=not in_test_env,
               use_debugger=not in_test_env,
               use_evalex=not in_test_env,
               threaded=True)
コード例 #3
0
ファイル: app.py プロジェクト: aboganas/frappe
def serve(port=8000, profile=False, site=None, sites_path='.'):
	global application, _site, _sites_path
	_site = site
	_sites_path = sites_path

	from werkzeug.serving import run_simple

	if profile:
		application = ProfilerMiddleware(application, sort_by=('cumtime', 'calls'))

	if not os.environ.get('NO_STATICS'):
		application = SharedDataMiddleware(application, {
			b'/assets': os.path.join(sites_path, 'assets').encode("utf-8"),
		})

		application = StaticDataMiddleware(application, {
			b'/files': os.path.abspath(sites_path).encode("utf-8")
		})

	application.debug = True
	application.config = {
		'SERVER_NAME': 'localhost:8000'
	}

	run_simple('0.0.0.0', int(port), application, use_reloader=True,
		use_debugger=True, use_evalex=True, threaded=True)
コード例 #4
0
ファイル: app.py プロジェクト: vhrspvl/vhrs-frappe
def serve(port=8000, profile=False, site=None, sites_path='.'):
	global application, _site, _sites_path
	_site = site
	_sites_path = sites_path

	from werkzeug.serving import run_simple

	if profile:
		application = ProfilerMiddleware(application, sort_by=('cumtime', 'calls'))

	if not os.environ.get('NO_STATICS'):
		application = SharedDataMiddleware(application, {
			'/assets': os.path.join(sites_path, 'assets'),
		})

		application = StaticDataMiddleware(application, {
			'/files': os.path.abspath(sites_path)
		})

	application.debug = True
	application.config = {
		'SERVER_NAME': 'localhost:8000'
	}

	in_test_env = os.environ.get('CI')
	if in_test_env:
		log = logging.getLogger('werkzeug')
		log.setLevel(logging.ERROR)

	run_simple('0.0.0.0', int(port), application,
		use_reloader=not in_test_env,
		use_debugger=not in_test_env,
		use_evalex=not in_test_env,
		threaded=True)
コード例 #5
0
ファイル: app.py プロジェクト: indictranstech/omnitech-frappe
def serve(port=8000, profile=False, site=None, sites_path="."):
    global application, _site, _sites_path
    _site = site
    _sites_path = sites_path

    from werkzeug.serving import run_simple

    if profile:
        application = ProfilerMiddleware(application, sort_by=("tottime", "calls"))

    if not os.environ.get("NO_STATICS"):
        application = SharedDataMiddleware(
            application, {b"/assets": os.path.join(sites_path, "assets").encode("utf-8")}
        )

        application = StaticDataMiddleware(application, {b"/files": os.path.abspath(sites_path).encode("utf-8")})

    application.debug = True
    application.config = {"SERVER_NAME": "localhost:8000"}

    run_simple("0.0.0.0", int(port), application, use_reloader=True, use_debugger=True, use_evalex=True, threaded=True)
コード例 #6
0
ファイル: app.py プロジェクト: Eddiy/frappe

application = local_manager.make_middleware(application)

if os.environ.get('FRAPPE_PROFILE'):
    application = ProfilerMiddleware(application, sort_by=('cumtime', 'calls'))

if os.environ.get('FRAPPE_STATICS'):
    application = SharedDataMiddleware(
        application, {
            b'/assets': os.path.join('.', 'assets').encode("utf-8"),
        })
    application = StaticDataMiddleware(
        application, {b'/files': os.path.abspath('.').encode("utf-8")})
if os.environ.get('FRAPPE_DEBUG'):
    application.debug = True


def serve(port=8000, profile=False, site=None, sites_path='.'):
    global application, _site, _sites_path
    _site = site
    _sites_path = sites_path

    from werkzeug.serving import run_simple

    if profile:
        application = ProfilerMiddleware(application,
                                         sort_by=('cumtime', 'calls'))

    if not os.environ.get('NO_STATICS'):
        application = SharedDataMiddleware(