
If a function raises an exception, any remainingĪfter_request functions will not be called. The function is called with the response object, and must returnĪ response object. Register a function to run after each request to this object. Options ( Any) – Extra options passed to the Respond to OPTIONS requests automatically. Provide_automatic_options ( Optional ) – Add the OPTIONS method and View_func ( Optional, Union, Tuple ], Union, Tuple ] ], Sequence, Tuple ] ] ] ] ], Tuple ], int ], Tuple ], int, Union, Tuple ] ], Sequence, Tuple ] ] ] ] ], WSGIApplication ] ] ]) – The view function to associate with the ParametersĮndpoint ( Optional ) – The endpoint name to associate with the ruleĪnd view function. Has a provide_automatic_methods attribute, it is used as theĭefault if the parameter is not passed. Methods are added to the passed and automatic methods. If view_func has a required_methods attribute, those add_url_rule ( "/", endpoint = "index" ). Register a custom template global function. None add_template_global ( f, name = None ) ¶ Name ( Optional ) – the optional name of the filter, otherwise the This should only be set manually when it can’t be detectedĪutomatically, such as for namespace packages. Root_path ( Optional ) – The path to the root of the application files. Instance_relative_config ( bool) – if set to True relative filenames Package or module is assumed to be the instance Instance_path ( Optional ) – An alternative instance path for the application.īy default the folder 'instance' next to the 'templates' folder in the root path of the Template_folder ( Optional ) – the folder that contains the templates that should Subdomain_matching ( bool) – consider the subdomain relative to Host_matching ( bool) – set url_map.host_matching attribute. Static_host ( Optional ) – the host to use when adding the static route.ĭefaults to None. Static_folder ( Optional ]) – The folder with static files that is served at Static_url_path ( Optional ) – can be used to specify a different path for the

Import_name ( str) – the name of the application package New in version 0.7: The static_url_path, static_folder, and template_folder In the _init_.py file of your package like this: Usually you create a Flask instance in your main module or py file).įor more information about resource loading, see open_resource(). Package parameter resolves to an actual python package (a folder withĪn _init_.py file inside) or a standard module (just a. Package or the folder the module is contained in depending on if the The name of the package is used to resolve resources from inside the The view functions, the URL rules, template configuration and much more.

Once it is created it will act as a central registry for It is passed the name of the module or package of theĪpplication. The flask object implements a WSGI application and acts as the central

Flask ( import_name, static_url_path = None, static_folder = 'static', static_host = None, host_matching = False, subdomain_matching = False, template_folder = 'templates', instance_path = None, instance_relative_config = False, root_path = None ) ¶ Important right here and provide links to the canonical documentation. Parts where Flask depends on external libraries, we document the most This part of the documentation covers all the interfaces of Flask.
