Flask類的屬性和方法大全

Flask Property
__class__
__dict__
__doc__
__module__
app_ctx_globals_class
config_class
debug
default_config
error_handlers
get_send_file_max_age
has_static_folder
jinja_environment
jinja_loader
jinja_options
json_decoder
json_encoder
logger_name
open_resource
permanent_session_lifetime
request_class
request_globals_class
response_class
secret_key
send_file_max_age_default
send_static_file
session_cookie_name
session_interface
static_folder
static_url_path
test_client_class
testing
url_rule_class
use_x_sendfile
Flask Method
(classmethod) delattr
(classmethod) format
(classmethod) getattribute
(classmethod) hash
(staticmethod) new
(classmethod) reduce
(classmethod) reduce_ex
(classmethod) setattr
(classmethod) sizeof
(classmethod) str
(classmethod) subclasshook
(classmethod) weakref
(classmethod) inject_url_defaults
(classmethod) iter_blueprints
(setupmethod) register_blueprint
(classmethod) update_template_context
(setupmethod) add_template_filter
(classmethod) jinja_env
(property)propagate_exceptions
(classmethod) open_session
(classmethod) preprocess_request
(classmethod) raise_routing_exception
(setupmethod) before_request
(classmethod) should_ignore_error
(classmethod) init
(classmethod) try_trigger_before_first_request_functions
(classmethod) test_request_context
(setupmethod) url_value_preprocessor
(classmethod) make_config
(property)preserve_context_on_exception
(setupmethod) url_defaults
(classmethod) handle_http_exception
(setupmethod) before_first_request
(classmethod) select_jinja_autoescape
(classmethod) wsgi_app
(classmethod) handle_user_exception
(classmethod) test_client
(classmethod) create_jinja_environment
(classmethod) call
(classmethod) do_teardown_appcontext
(property)logger
(setupmethod) add_template_global
(setupmethod) template_filter
(setupmethod) shell_context_processor
(classmethod) process_response
(classmethod) run
(setupmethod) template_test
(classmethod) handle_url_build_error
(classmethod) do_teardown_request
(staticmethod) _get_exc_class_and_code
(classmethod) create_global_jinja_loader
(setupmethod) errorhandler
(classmethod) log_exception
(setupmethod) context_processor
(classmethod) full_dispatch_request
(setupmethod) teardown_appcontext
(classmethod) register_error_handler
(classmethod) create_url_adapter
(classmethod) make_null_session
(classmethod) init_jinja_globals
(classmethod) _find_error_handler
(classmethod) finalize_request
(classmethod) save_session
(setupmethod) endpoint
(classmethod) name
(classmethod) make_default_options_response
(setupmethod) _register_error_handler
(classmethod) dispatch_request
(setupmethod) add_url_rule
(classmethod) route
(classmethod) open_instance_resource
(classmethod) handle_exception
(classmethod) app_context
(classmethod) make_shell_context
(property)got_first_request
(setupmethod) template_global
(classmethod) repr
(classmethod) make_response
(classmethod) request_context
(classmethod) auto_find_instance_path
(setupmethod) add_template_test
(setupmethod) after_request
(setupmethod) teardown_request
(classmethod) trap_http_exception

Flask版本0.12。

Flask Property

__class__

介紹: 用於存放當前對象實例所屬的類型,值是:<class 'flask.app.Flask'>。**注意在未修改__class__的狀況下,type(A)=A.class

shell

__dict__

介紹: 用於存放當前對象的全部屬性。其內容是本文數據字典的子集。

json

__doc__

介紹: 保存類的文檔字符串。能夠經過help函數或者inspect.getdoc(Class)得到。

flask

__module__

介紹: 類所屬的模塊。

cookie

app_ctx_globals_class

介紹:

session

config_class

介紹:

app

debug

介紹:

ssh

default_config

介紹:

ide

error_handlers

介紹:

函數

get_send_file_max_age

介紹:

ui

has_static_folder

介紹:

jinja_environment

介紹:

jinja_loader

介紹:

jinja_options

介紹:

json_decoder

介紹:

json_encoder

介紹:

logger_name

介紹:

open_resource

介紹:

permanent_session_lifetime

介紹:

request_class

介紹:

request_globals_class

介紹:

response_class

介紹:

secret_key

介紹:

send_file_max_age_default

介紹:

send_static_file

介紹:

介紹:

session_interface

介紹:

static_folder

介紹:

static_url_path

介紹:

test_client_class

介紹:

testing

介紹:

url_rule_class

介紹:

use_x_sendfile

介紹:

Flask Method

(classmethod) delattr

介紹:刪除屬性attr;內建函數self.delattr(attr)時被調用。

(classmethod) format

介紹: 格式化字符串的輸出.

(classmethod) getattribute

介紹: 訪問Flask的屬性時調用該函數。老是被調用。

(classmethod) hash

介紹: 散列函數值,調用該方法能夠獲得對象的7位哈希數字。

(staticmethod) new

介紹: 靜態方法,用於建立類實例;它在__init__以前被調用。

(classmethod) reduce

介紹: 沒找到介紹。

(classmethod) reduce_ex

介紹: 沒找到介紹

(classmethod) setattr

介紹: 設置屬性attr;內建函數self.setattr(self,attr,val)的調用;

(classmethod) sizeof

介紹: 沒找到介紹

(classmethod) str

介紹: :當前對象被字符串化時被調用;內建函數str(self)函數,或print(self)的調用;

(classmethod) subclasshook

介紹: 沒找到介紹

(classmethod) weakref

介紹: 沒找到介紹

(classmethod) inject_url_defaults

參數: endpoint,values
介紹:

(classmethod) iter_blueprints

介紹:

(setupmethod) register_blueprint

參數: blueprint,**options
介紹:

(classmethod) update_template_context

參數: context
介紹:

(setupmethod) add_template_filter

參數: f,name=None
介紹:

(classmethod) jinja_env

介紹:

(property)propagate_exceptions

介紹:

(classmethod) open_session

參數: request
介紹:

(classmethod) preprocess_request

介紹:

(classmethod) raise_routing_exception

參數: request
介紹:

(setupmethod) before_request

參數: f
介紹:

(classmethod) should_ignore_error

參數: error
介紹:

(classmethod) init

參數: import_name, static_path = None, static_url_path = None,static_folder = 'static', template_folder = 'templates',instance_path = None, instance_relative_config = False,root_path = None
介紹:

(classmethod) try_trigger_before_first_request_functions

介紹:

(classmethod) test_request_context

參數: args,*kwargs
介紹:

(setupmethod) url_value_preprocessor

參數: f
介紹:

(classmethod) make_config

參數: instance_relative=False
介紹:

(property)preserve_context_on_exception

介紹:

(setupmethod) url_defaults

參數: f
介紹:

(classmethod) handle_http_exception

參數: e
介紹:

(setupmethod) before_first_request

參數: f
介紹:


(classmethod) select_jinja_autoescape

參數: filename
介紹:

(classmethod) wsgi_app

參數: environ,start_response
介紹:

(classmethod) handle_user_exception

參數: e
介紹:

(classmethod) test_client

參數: use_cookies=True,**kwargs
介紹:

(classmethod) create_jinja_environment

介紹:

(classmethod) call

參數: environ,start_response
介紹:

(classmethod) do_teardown_appcontext

參數: exc=_sentinel
介紹:

(property)logger

介紹:

(setupmethod) add_template_global

參數: f,name=None
介紹:

(setupmethod) template_filter

參數: name=None
介紹:

(setupmethod) shell_context_processor

參數: f
介紹:

(classmethod) process_response

參數: response
介紹:

(classmethod) run

參數: host=None,port=None,debug=None,**options
介紹:

(setupmethod) template_test

參數: name=None
介紹:

(classmethod) handle_url_build_error

參數: error,endpoint,values
介紹:

(classmethod) do_teardown_request

參數: exc=_sentinel
介紹:

(staticmethod) _get_exc_class_and_code

參數: exc_class_or_code
介紹:

(classmethod) create_global_jinja_loader

介紹:

(setupmethod) errorhandler

參數: code_or_exception
介紹:

(classmethod) log_exception

參數: exc_info
介紹:

(setupmethod) context_processor

參數: f
介紹:

(classmethod) full_dispatch_request

介紹:

(setupmethod) teardown_appcontext

參數: f
介紹:

(classmethod) register_error_handler

參數: code_or_exception,f
介紹:

(classmethod) create_url_adapter

參數: request
介紹:

(classmethod) make_null_session

介紹:

(classmethod) init_jinja_globals

介紹:

(classmethod) _find_error_handler

參數: e
介紹:

(classmethod) finalize_request

參數: rv,from_error_handler=False
介紹:

(classmethod) save_session

參數: session,response
介紹:

(setupmethod) endpoint

參數: endpoint
介紹:

(classmethod) name

介紹:

(classmethod) make_default_options_response

介紹:

(setupmethod) _register_error_handler

參數: key,code_or_exception,f
介紹:

(classmethod) dispatch_request

介紹:

(setupmethod) add_url_rule

參數: rule,endpoint=None,view_func=None,**options
介紹:

(classmethod) route

參數: rule,**options
介紹:

(classmethod) open_instance_resource

參數: resource,mode='rb'
介紹:

(classmethod) handle_exception

參數: e
介紹:

(classmethod) app_context

介紹:

(classmethod) make_shell_context

介紹:

(property)got_first_request

介紹:

(setupmethod) template_global

參數: name=None
介紹:

(classmethod) repr

介紹:

(classmethod) make_response

參數: rv
介紹:

(classmethod) request_context

參數: environ
介紹:

(classmethod) auto_find_instance_path

介紹:

(setupmethod) add_template_test

參數: f,name=None
介紹:

(setupmethod) after_request

參數: f
介紹:

(setupmethod) teardown_request

參數: f
介紹:

(classmethod) trap_http_exception

參數: e
介紹:

方法類型介紹:

  • 成員方法:類方法中第一個參數是self的爲類成員方法。
  • classmethod 類方法中第一個參數是cls(類對象)的方法
  • property 類變量的只讀方法: 使用了裝飾器@property的方法
  • staticmethod: 使用了裝飾器@staticmethod的靜態方法。靜態方法和類方法類似,區別是靜態方法不關注對象和對象內部屬性,靜態方法不強制要求參數。
  • setupmethod

@classmethod means: when this method is called, we pass the class as the first argument instead of the instance of that class (as we normally do with methods). This means you can use the class and its properties inside that method rather than a particular instance. @staticmethod means: when this method is called, we don't pass an instance of the class to it (as we normally do with methods). This means you can put a function inside a class but you can't access the instance of that class (this is useful when your method does not use the instance).

相關文章
相關標籤/搜索