| from wsgidav.wsgidav_app import WsgiDAVApp |
| from wsgidav.fs_dav_provider import FilesystemProvider |
| from cheroot.wsgi import Server as WSGIServer |
| import os |
|
|
| |
| HOST = "0.0.0.0" |
| PORT = 7860 |
| PATH = "./webauth" |
|
|
| |
| if not os.path.exists(PATH): |
| os.makedirs(PATH) |
| print(f"Created directory: {PATH}") |
|
|
| |
| sample_file_path = os.path.join(PATH, "test.txt") |
| with open(sample_file_path, "w") as f: |
| f.write("This is a sample file for testing the WebDAV server.\n") |
| print(f"Created sample file: {sample_file_path}") |
|
|
| |
| provider = FilesystemProvider(PATH) |
|
|
| |
| config = { |
| "provider_mapping": { |
| "/": provider, |
| }, |
| "http_authenticator": { |
| "domain_controller": None, |
| }, |
| "simple_dc": None, |
| "verbose": 1, |
| } |
|
|
| |
| app = WsgiDAVApp(config) |
|
|
| |
| server = WSGIServer((HOST, PORT), app) |
|
|
| |
| print(f"WebDAV server running on http://{HOST}:{PORT}") |
| server.start() |