grzegorz-clients/main.py

34 lines
793 B
Python
Raw Normal View History

2018-02-26 22:55:01 +01:00
#!/usr/bin/env python3
from remi import start
import api
import gui
2018-02-26 22:55:01 +01:00
# config must be a object with the attributes::
# config.host: str
# config.port: str
# config.start_browser: bool
# config.multiple_instance: bool
def main(config):
assert hasattr(config, "host")
assert hasattr(config, "port")
assert hasattr(config, "start_browser")
assert hasattr(config, "multiple_instance")
# start the webserver:
api.BASE_URL = config.api_base
2018-02-26 22:55:01 +01:00
start(
gui.MyApp,
2018-02-26 22:55:01 +01:00
title = "Gregorz",
address = config.host,
port = config.port,
start_browser = config.start_browser,
multiple_instance = config.multiple_instance,
enable_file_cache = True
)
if __name__ == "__main__":
if not os.path.exists("config.py"):
shutil.copy("default_config.py", "config.py")
import config
main(config)