Skip to content
Snippets Groups Projects
Verified Commit 4fca5087 authored by Stefan Hynek's avatar Stefan Hynek :drooling_face:
Browse files

feat(main.py): initialize and launch the wsgi server process

parent 86859a07
No related branches found
No related tags found
No related merge requests found
import logging
import os
from cheroot import wsgi
from wsgidav.wsgidav_app import WsgiDAVApp
logging.basicConfig(level=logging.DEBUG,
format='%(name)s %(levelname)s %(asctime)s %(message)s')
_logger = logging.getLogger(__name__)
_logger.propagate = True
# configure the "wsgidav" named logger
tmp_logger = logging.getLogger("wsgidav")
tmp_logger.propagate = True
tmp_logger.setLevel(logging.DEBUG)
# Configuration of the WsgiDAVApp.
# https://wsgidav.readthedocs.io/en/latest/user_guide_configure.html
config = {
"host": os.getenv("host"),
"port": int(os.getenv("port")),
"provider_mapping": {
"/": {"provider": "repdav.textgrid_dav_provider.TextgridResourceProvider"},
},
"verbose": 1,
"simple_dc": {
"user_mapping": {
"*": {
"user": {
"password": "pass"}}
}
},
"http_authenticator": {
"domain_controller": "repdav.textgrid_domain_controller.TextgridDC",
"accept_basic": True, # Allow basic authentication, True or False
"accept_digest": False, # Allow digest authentication, True or False
# True (default digest) or False (default basic)
"default_to_digest": False,
# Name of a header field that will be accepted as authorized user
"trusted_auth_header": None,
}
}
app = WsgiDAVApp(config)
server_args = {
"bind_addr": (config["host"], config["port"]),
"wsgi_app": app,
}
server = wsgi.Server(**server_args)
server.start()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment