Replies: 1 comment
-
Hi, you could try this pattern to enable logging and Ctrl-C handling: import os
from cheroot import wsgi
from wsgidav.wsgidav_app import WsgiDAVApp
from wsgidav.util import init_logging
# current directory path
cur_dir = os.getcwd()
print(f"[+] Current directory path: {cur_dir}")
config = {
"host": "0.0.0.0",
"port": 8080,
"provider_mapping": {
"/": cur_dir,
},
"verbose": 5,
"logging": {
"enable": True, # @since 4.3.0
},
# HTTP Authentication Options
"http_authenticator": {
"domain_controller": None,
"accept_basic": False,
"trusted_auth_header": None,
},
}
# Before v4.3.0:
# init_logging(config)
app = WsgiDAVApp(config)
server_args = {
"bind_addr": (config["host"], config["port"]),
"wsgi_app": app,
}
server = wsgi.Server(**server_args)
try:
print("Starting server...")
server.start()
except KeyboardInterrupt:
print("Caught Ctrl-C: stopping...")
finally:
server.stop() |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to implement a webdav server with python library on windows 10. Here is the script that I am using
Problems I am facing:
How can I fix those two issues, kindly assist. Most of the script I have created from the example/documentation you have provided is there anything I am doing wrong?
Also how does one quit after server.start() is called. When I do a
CTRL + C
I get the below error and I am forced to kill the whole command prompt window.Now is there a way to kill the server like
server.stop()
. I noticed this is awsgi
library issue and notwsgidav
library. But I have been looking for the option to stop it but still unable. Anyways one step at a time. How to fix the first two issues.Weird thing the command line option works pretty well, but I want to use the library.
Beta Was this translation helpful? Give feedback.
All reactions