當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。