publish_dir()
Upload the files in a folder. pattern is a regular expression on the paths.
Usage
publish_dir(
dir: str | Path,
dest: str | None = None,
connection: str | None = None,
pattern: str | None = None,
recursive: bool = True,
include_private: bool = False,
*,
allow_private: bool | None = None,
) -> list[str]
Arguments
| Name | Type | Default | Description |
|---|---|---|---|
| dir required | str | Path |
The folder to upload. |
|
| dest | str | None | None |
The folder in the bucket. Each file keeps its path relative to |
| connection | str | None | None |
A storage bucket name from the settings. Default: the project's default bucket, then one marked |
| pattern | str | None | None |
Only upload files whose path matches this regular expression (searched anywhere in the path). Default: every file. |
| recursive | bool | True |
Include files in subfolders. |
| include_private | bool | False |
Upload files with "private" in their path without asking. Only a person who has reviewed the files should set this. |
| allow_private | bool | None | None |
Deprecated name for |
Value
The public URL of each file uploaded. The list is empty when no file matched.
Raises
FrameworkError: When the folder is missing, a file has "private" in its path and is not confirmed, no bucket is configured, or an upload fails.