Class: BustAPI
The main application class. You usually create one instance of this per application.
class BustAPI(import_name: str = None, static_folder: str = 'static', template_folder: str = 'templates')
Constructor Arguments
- import_name (
str): The name of the application package. Using__name__is standard. - static_folder (
str): The folder where static files are served from. Default:'static'. - template_folder (
str): The folder containing Jinja2 templates. Default:'templates'.
Methods
run(host='127.0.0.1', port=5000, debug=False)
Starts the development server. This runs a single-process server suitable for development.
- host: The hostname to listen on. Set to
'0.0.0.0'to make the server available externally. - port: The port to listen on.
- debug: If
True, enables hot-reloading and debug pages.
route(rule, **options)
A decorator to register a function as a view handler.
See Also
Refer to the Routing section for detailed usage.
register_blueprint(blueprint, **options)
Registers a blueprint with the application.
- blueprint: The
Blueprintinstance to register. - url_prefix (optional): Prefix to prepend to all routes in the blueprint.
before_request(f)
Registers a function to run before each request.
after_request(f)
Registers a function to run after each request. Expected to return the response object.
BustAPI