matemat/matemat/__main__.py

24 lines
640 B
Python
Raw Normal View History

2018-07-11 22:06:06 +02:00
from typing import Any, Dict
import sys
2018-07-11 22:06:06 +02:00
from matemat import parse_config_file
if __name__ == '__main__':
# Those imports are actually needed, as they implicitly register pagelets.
# noinspection PyUnresolvedReferences
from matemat.webserver.pagelets import *
from matemat.webserver import MatematWebserver
2018-07-11 22:06:06 +02:00
# Use config file name from command line, if present
configfile: str = '/etc/matemat.conf'
if len(sys.argv) > 1:
2018-07-11 22:06:06 +02:00
configfile = sys.argv[1]
# 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()