diff --git a/Dockerfile b/Dockerfile index 9ea3057..5925c5c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,4 +12,4 @@ COPY . . EXPOSE 5000 # Run with Gunicorn -CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "4", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "app:app"] \ No newline at end of file +CMD ["gunicorn", "--config", "gunicorn_config.py", "--bind", "0.0.0.0:5000", "--workers", "4", "app:app"] \ No newline at end of file diff --git a/app.py b/app.py index a8e0954..0591920 100644 --- a/app.py +++ b/app.py @@ -28,7 +28,7 @@ app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(hours=1) # 1. Define the version -APP_VERSION = '0.17.1' # Bumped version for modular architecture +APP_VERSION = '0.17.2' # Bumped version for modular architecture # 2. Inject it into all templates automatically @app.context_processor diff --git a/gunicorn_config.py b/gunicorn_config.py new file mode 100644 index 0000000..285ac8d --- /dev/null +++ b/gunicorn_config.py @@ -0,0 +1,11 @@ +def on_starting(server): + """Called just before the master process is initialized""" + print("Gunicorn starting...") + +def post_fork(server, worker): + """Called just after a worker has been forked""" + from module_manager import get_module_manager + from app import app + + module_manager = get_module_manager() + module_manager.load_active_modules(app) \ No newline at end of file