Configuration#
- class quart_uploads.UploadConfig(destination: str, base_url: str | None = None, allow: tuple = (), deny: tuple = ())#
This holds the configuration for a single UploadSet. The constructor’s arguments are also the attributes.
- Parameters:
destination – The directory to save files to.
base_url – The URL (ending with a /) that files can be downloaded from.
None (If this is)
itself. (Quart-Uploads will serve the files)
allow – A tuple of extensions to allow, even if they’re not in the
list. (UploadSet extensions)
deny – A tuple of extensions to deny, even if they are in the
list.
- property tuple: tuple#
Returns the configuration as a tuple.
- class quart_uploads.Uploads(app: Quart)#
Custom dictionary for storing UploadConfig objects on the Quart application.
This will be stored at Quart.extensions.
- get(k[, d]) D[k] if k in D, else d. d defaults to None.#
- quart_uploads.configure_uploads(app: Quart, upload_sets: UploadSet | tuple[UploadSet, ...]) None#
Call this after the app has been configured. It will go through all the upload sets, get their configuration, and store the configuration on the app. It will also register the uploads module if it hasn’t been set. This can be called multiple times with different upload sets. The uploads module/blueprint will only be registered if it is needed to serve the upload sets.
- Parameters:
app – The ~quart.Quart instance to get the configuration from.
upload_sets – The UploadSet instances to configure.