当前位置: 首页>>代码示例>>Python>>正文


Python Flask.run方法代码示例

本文整理汇总了Python中flask.Flask.run方法的典型用法代码示例。如果您正苦于以下问题:Python Flask.run方法的具体用法?Python Flask.run怎么用?Python Flask.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在flask.Flask的用法示例。


在下文中一共展示了Flask.run方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import run [as 别名]
def main(self, *args, **kwargs):
        # Set a global flag that indicates that we were invoked from the
        # command line interface. This is detected by Flask.run to make the
        # call into a no-op. This is necessary to avoid ugly errors when the
        # script that is loaded here also attempts to start a server.
        os.environ['FLASK_RUN_FROM_CLI'] = 'true'

        if get_load_dotenv(self.load_dotenv):
            load_dotenv()

        obj = kwargs.get('obj')

        if obj is None:
            obj = ScriptInfo(create_app=self.create_app)

        kwargs['obj'] = obj
        kwargs.setdefault('auto_envvar_prefix', 'FLASK')
        return super(FlaskGroup, self).main(*args, **kwargs) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:20,代码来源:cli.py

示例2: show_server_banner

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import run [as 别名]
def show_server_banner(env, debug, app_import_path, eager_loading):
    """Show extra startup messages the first time the server is run,
    ignoring the reloader.
    """
    if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
        return

    if app_import_path is not None:
        message = ' * Serving Flask app "{0}"'.format(app_import_path)

        if not eager_loading:
            message += ' (lazy loading)'

        click.echo(message)

    click.echo(' * Environment: {0}'.format(env))

    if env == 'production':
        click.secho(
            '   WARNING: Do not use the development server in a production'
            ' environment.', fg='red')
        click.secho('   Use a production WSGI server instead.', dim=True)

    if debug is not None:
        click.echo(' * Debug mode: {0}'.format('on' if debug else 'off')) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:27,代码来源:cli.py

示例3: main

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import run [as 别名]
def main(self, *args, **kwargs):
        # Set a global flag that indicates that we were invoked from the
        # command line interface. This is detected by Flask.run to make the
        # call into a no-op. This is necessary to avoid ugly errors when the
        # script that is loaded here also attempts to start a server.
        os.environ['FLASK_RUN_FROM_CLI'] = 'true'

        if get_load_dotenv(self.load_dotenv):
            load_dotenv()

        obj = kwargs.get('obj')

        if obj is None:
            obj = ScriptInfo(create_app=self.create_app,
                             set_debug_flag=self.set_debug_flag)

        kwargs['obj'] = obj
        kwargs.setdefault('auto_envvar_prefix', 'FLASK')
        return super(FlaskGroup, self).main(*args, **kwargs) 
开发者ID:PacktPublishing,项目名称:Building-Recommendation-Systems-with-Python,代码行数:21,代码来源:cli.py

示例4: show_server_banner

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import run [as 别名]
def show_server_banner(env, debug, app_import_path, eager_loading):
    """Show extra startup messages the first time the server is run,
    ignoring the reloader.
    """
    if os.environ.get('WERKZEUG_RUN_MAIN') == 'true':
        return

    if app_import_path is not None:
        message = ' * Serving Flask app "{0}"'.format(app_import_path)

        if not eager_loading:
            message += ' (lazy loading)'

        click.echo(message)

    click.echo(' * Environment: {0}'.format(env))

    if env == 'production':
        click.secho(
            '   WARNING: This is a development server. '
            'Do not use it in a production deployment.', fg='red')
        click.secho('   Use a production WSGI server instead.', dim=True)

    if debug is not None:
        click.echo(' * Debug mode: {0}'.format('on' if debug else 'off')) 
开发者ID:PacktPublishing,项目名称:Building-Recommendation-Systems-with-Python,代码行数:27,代码来源:cli.py

示例5: run

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import run [as 别名]
def run(self, host=None, port=None, debug=None, **options):
        '''
        WebAPP.run like Flask.run
        '''
        self.args['DEBUG'] = debug
        Flask.run(self, host, port, debug, **options) 
开发者ID:bxtkezhan,项目名称:BAR4Py,代码行数:8,代码来源:web.py


注:本文中的flask.Flask.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。