From 3372179feb8e2ef1bfb2de2f5cac267b6bc3e27f Mon Sep 17 00:00:00 2001 From: Alban Date: Wed, 21 Nov 2012 12:47:08 +0100 Subject: [PATCH] WSGI script and fix redirect when not logged in --- main.wsgi | 17 +++++++++++++++++ web.py | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 main.wsgi diff --git a/main.wsgi b/main.wsgi new file mode 100644 index 0000000..7127181 --- /dev/null +++ b/main.wsgi @@ -0,0 +1,17 @@ +# coding: utf-8 + +import os.path, sys +sys.path.insert(0, '/path/to/the/supysonic/app') + +import config +if not config.check(): + sys.exit(1) + +if not os.path.exists(config.get('CACHE_DIR')): + os.makedirs(config.get('CACHE_DIR')) + +import db +db.init_db() + +from web import app as application + diff --git a/web.py b/web.py index 4219cb0..4432d23 100755 --- a/web.py +++ b/web.py @@ -28,7 +28,7 @@ def init_and_login_check(): if should_login: flash('Please login') - return redirect(url_for('login', returnUrl = request.url[len(request.url_root)-1:])) + return redirect(url_for('login', returnUrl = request.script_root + request.url[len(request.url_root)-1:])) @app.teardown_request def teardown(exception):