diff --git a/management/wsgi.py b/management/wsgi.py index 2cad5f44..ae8440fa 100644 --- a/management/wsgi.py +++ b/management/wsgi.py @@ -1,5 +1,14 @@ -from management.daemon import app -import utils +from daemon import app +import auth, utils + +from werkzeug.middleware.proxy_fix import ProxyFix + +app.wsgi_app = ProxyFix( + app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1 +) + +env = utils.load_environment() +auth_service = auth.AuthService() app.logger.addHandler(utils.create_syslog_handler()) diff --git a/setup/management.sh b/setup/management.sh index 5af4474a..19cb9e1a 100755 --- a/setup/management.sh +++ b/setup/management.sh @@ -99,7 +99,8 @@ export LANG=en_US.UTF-8 export LC_TYPE=en_US.UTF-8 source $venv/bin/activate -exec gunicorn -b localhost:10222 -w 2 management.wsgi:app +export PYTHONPATH=$(pwd) +exec gunicorn -b localhost:10222 -w 2 wsgi:app EOF chmod +x $inst_dir/start cp --remove-destination conf/mailinabox.service /lib/systemd/system/mailinabox.service # target was previously a symlink so remove it first