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


Python Flask.modules方法代码示例

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


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

示例1: setupmethod

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import modules [as 别名]
def setupmethod(f):
    """Wraps a method so that it performs a check in debug mode if the
    first request was already handled.
    """
    def wrapper_func(self, *args, **kwargs):
        if self.debug and self._got_first_request:
            raise AssertionError('A setup function was called after the '
                'first request was handled.  This usually indicates a bug '
                'in the application where a module was not imported '
                'and decorators or other functionality was called too late.\n'
                'To fix this make sure to import all your view modules, '
                'database models and everything related at a central place '
                'before the application starts serving requests.')
        return f(self, *args, **kwargs)
    return update_wrapper(wrapper_func, f) 
开发者ID:chalasr,项目名称:Flask-P2P,代码行数:17,代码来源:app.py

示例2: name

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import modules [as 别名]
def name(self):
        """The name of the application.  This is usually the import name
        with the difference that it's guessed from the run file if the
        import name is main.  This name is used as a display name when
        Flask needs the name of the application.  It can be set and overridden
        to change the value.

        .. versionadded:: 0.8
        """
        if self.import_name == '__main__':
            fn = getattr(sys.modules['__main__'], '__file__', None)
            if fn is None:
                return '__main__'
            return os.path.splitext(os.path.basename(fn))[0]
        return self.import_name 
开发者ID:chalasr,项目名称:Flask-P2P,代码行数:17,代码来源:app.py

示例3: modules

# 需要导入模块: from flask import Flask [as 别名]
# 或者: from flask.Flask import modules [as 别名]
def modules(self):
        from warnings import warn
        warn(DeprecationWarning('Flask.modules is deprecated, use '
                                'Flask.blueprints instead'), stacklevel=2)
        return self.blueprints 
开发者ID:chalasr,项目名称:Flask-P2P,代码行数:7,代码来源:app.py


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