matemat/matemat/__main__.py

29 lines
700 B
Python
Raw Normal View History

from typing import Any, Dict, Iterable, Union
2018-07-11 22:06:06 +02:00
import sys
from matemat.webserver import MatematWebserver
from matemat.webserver import parse_config_file
2018-07-11 22:06:06 +02:00
# Those imports are actually needed, as they implicitly register pagelets.
# noinspection PyUnresolvedReferences
from matemat.webserver.pagelets import *
def main():
2018-07-11 22:06:06 +02:00
# Use config file name from command line, if present
configfile: Union[str, Iterable[str]] = '/etc/matemat.conf'
if len(sys.argv) > 1:
configfile = sys.argv[1:]
2018-07-11 22:06:06 +02:00
# Parse the config file
config: Dict[str, Any] = parse_config_file(configfile)
# Start the web server
2018-07-11 22:06:06 +02:00
MatematWebserver(**config).start()
if __name__ == '__main__':
main()