From cfa079de0daed947070d2870856b406694cd6e62 Mon Sep 17 00:00:00 2001 From: Helmut Merz Date: Sun, 6 Oct 2024 11:24:00 +0200 Subject: [PATCH] fixes for server start functionality and inst examples --- inst/loops/config.py | 2 +- inst/loops/runserver.sh | 5 +++-- inst/loops/zshell.sh | 3 ++- loops/server/main.py | 3 ++- loops/server/psu.py | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/inst/loops/config.py b/inst/loops/config.py index 82f9f76..5504dd5 100644 --- a/inst/loops/config.py +++ b/inst/loops/config.py @@ -9,7 +9,7 @@ zope_conf = getenv('ZOPE_CONF', 'zope.conf') server_port = getenv('SERVER_PORT', '8099') shell_pw = (getenv('SHELL_PW', 'dummy')) - +loops_path = (getenv('LOOPS_PATH', None)) # storage settings from scopes.storage.db.postgres import StorageFactory diff --git a/inst/loops/runserver.sh b/inst/loops/runserver.sh index eca9cdc..446c158 100755 --- a/inst/loops/runserver.sh +++ b/inst/loops/runserver.sh @@ -1,7 +1,8 @@ # inst/loops/runserver.sh +set -a # use environment variables for instance-specific configuration: -#ZOPE_CONF=zope.conf -#SERVER_PORT=8099 +#ZOPE_CONF=zope-1.conf +#SERVER_PORT=8091 python -c "from loops.server.main import main; main()" diff --git a/inst/loops/zshell.sh b/inst/loops/zshell.sh index a961be0..c1c0473 100755 --- a/inst/loops/zshell.sh +++ b/inst/loops/zshell.sh @@ -1,7 +1,8 @@ # inst/loops/zshell.sh +set -a # use environment variables for instance-specific configuration: -#ZOPE_CONF=zope.conf +#ZOPE_CONF=zope-1.conf #LOOPS_PATH=sites/mysite python -ic "from loops.server import psu; psu.setup()" diff --git a/loops/server/main.py b/loops/server/main.py index 1d3fb57..382b212 100644 --- a/loops/server/main.py +++ b/loops/server/main.py @@ -19,7 +19,8 @@ def run(app, config): def main(): import config zope_conf = getattr(config, 'zope_conf', 'zope.conf') - app = getWSGIApplication('zope.conf') + print(f'starting loops server... - conf: {zope_conf}') + app = getWSGIApplication(zope_conf) run(app, config) if __name__ == '__main__': diff --git a/loops/server/psu.py b/loops/server/psu.py index 572eb5b..8ec0237 100644 --- a/loops/server/psu.py +++ b/loops/server/psu.py @@ -50,7 +50,7 @@ def closeConnection(): print('closing ZODB connection...') conn.close() -def setup(zope_conf=None, loopsRootPath='sites/loops', config=config): +def setup(zope_conf=None, loopsRootPath=None, config=config): if zope_conf is None: zope_conf = getattr(config, 'zope_conf', 'zope.conf') if loopsRootPath is None: