This application allows you easily save media and static files into webdav storage.
Dependencies
requests library
Installation
Install the package
pip install django-webdav-storage
Pick the webdav server url in WEBDAV_URL and WEBDAV_PUBLIC_URL:
WEBDAV_URL = 'http://webdav.example.com/',
WEBDAV_PUBLIC_URL = 'http://webdav.example.com/'
If you want use HTTP Basic authorization to webdav access, you can specify your credentials like that:
WEBDAV_URL = 'http://johndoe:secret@webdav.example.com/'
Set the webdav storage class as default:
DEFAULT_FILE_STORAGE = 'django_webdav_storage.storage.WebDavStorage'
If your webdav backend can’t recursively create path (e.g. nginx can do this, while apache can’t), set the WEBDAV_RECURSIVE_MKCOL variable to True:
WEBDAV_RECURSIVE_MKCOL = True
If you use nginx as webdav server and want to enable storage directory listing, set the WEBDAV_LISTING_BACKEND option to:
WEBDAV_LISTING_BACKEND = 'django_webdav_storage.listing.nginx_autoindex'
Autoindex feature must be enabled in your nginx configuration for application servers (see example below). Be careful! Allowing autoindex for any user may lead to security and performance issues.
Also, you may specify path to other function with the following interface:
def listdir(storage_object, path_string):
return dirs_list, files_list
The nginx webdav configuration example
# Public readonly media server.
server {
listen 80;
charset utf-8;
server_tokens off;
server_name media.example.com;
access_log /var/log/nginx/media_access.log;
error_log /var/log/nginx/media_error.log;
root /usr/share/nginx/webdav;
}
# WebDAV server
server {
listen 80;
charset utf-8;
server_tokens off;
server_name webdav.example.com;
access_log /var/log/nginx/webdav_access.log;
error_log /var/log/nginx/webdav_error.log;
root /usr/share/nginx/webdav;
client_max_body_size 10m;
client_body_temp_path /tmp;
create_full_put_path on;
autoindex on;
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_access user:rw group:r all:r;
satisfy any;
allow 127.0.0.1/32;
deny all;
auth_basic 'My WebDAV area';
auth_basic_user_file /usr/share/nginx/.htpasswd;
}
Caveats
In python 3.x ContentFile with text mode content (not binary one) will causes TypeError due requests restrictions
Metadata
Release files for dj-webdav-storage 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dj-webdav-storage-0.6.1.tar.gz | 6.4 kB | Without provenance | Details |
Release files / dj-webdav-storage-0.6.1.tar.gz
| Download URL | dj-webdav-storage-0.6.1.tar.gz |
|---|---|
| Size | 6.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72f49f73ab40ac338710cf8034bc32fbaf7be2dc0442e7f3baa1ea98e86fb8d5
|
|
BLAKE2b-256 checksum How to use checksums |
fba40ff2c3000f419fff8286d5c9f921768fb994a9d3de6fcf501575326bd897
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for dj-webdav-storage 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.