WsgiDAV

A generic and extendable WebDAV server written in Python and based on WSGI. It can be used to share files between across your various devices or with friends.


Note

For this guide you should be familiar with the basic concepts of

Installation

Use pip3 to install wsgidav:

[isabell@stardust ~]$ pip3 install wsgidav cheroot --user

Create the data folder:

[isabell@stardust ~]$ mkdir ~/webdav

Add additional folders you want to access via webdav with:

[isabell@stardust ~]$ mkdir ~/webdav/<newfoldername>

Config file

Note

Only use spaces to indent in the config file! No tabs!

We will modify this example config (YAML): https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html#sample-wsgidav-yaml

Define which folder should be accessible:

mount_path: null
provider_mapping:
    "/": "/home/isabell/webdav/"
    "/firstpath": "/home/isabell/webdav/<newpath>"
# Adds folder "/home/isabell/webdav/<newpath>" to URL https://isabell.uber.space/firstpath

Add user and password for every path:

simple_dc:
    user_mapping:
        "*":  # default (used for all shares that are not explicitly listed). Keep this one!
            "isabell":
                password: "<password>" # Change it!
                roles: ["editor"]
        "/firstpath": # The mount_path this user has access to.
            "isabellscousin": # Username
                password: "<password>" # Password. Change it!
# You can add multiple users for every path.

Save the file here:

~/etc/wsgidav.yaml

Configure web server

Note

wsgidav is running on port 8080.

To make the application accessible from the outside, configure a web backend:

[isabell@stardust ~]$ uberspace web backend set / --http --port <port>
Set backend for / to port <port>; please make sure something is listening!
You can always check the status of your backend using "uberspace web backend list".
[isabell@stardust ~]$

Configure supervisord

Create ~/etc/services.d/wsgidav.ini with the following content:

[program:wsgidav]
command=wsgidav -c %(ENV_HOME)s/etc/wsgidav.yaml
directory = %(ENV_HOME)s/webdav
autostart=yes
autorestart=yes

Start Service

After creating the configuration, tell supervisord to refresh its configuration and start the service:

[isabell@stardust ~]$ supervisorctl reread
SERVICE: available
[isabell@stardust ~]$ supervisorctl update
SERVICE: added process group
[isabell@stardust ~]$ supervisorctl status
SERVICE                            RUNNING   pid 26020, uptime 0:03:14
[isabell@stardust ~]$

Now go to https://<username>.uber.space (would be https://isabell.uber.space in our example) and see if it works. Enjoy!


Tested with wsgidav 3.0.0, Uberspace 7.3.4.2

Written by: Sebastian Burschel <https://github.com/SeBaBu/>