1
0
mirror of https://github.com/spl0k/supysonic.git synced 2024-11-09 19:52:16 +00:00

WSGI script and fix redirect when not logged in

This commit is contained in:
Alban 2012-11-21 12:47:08 +01:00 committed by Alban
parent 64cbccf9ad
commit 3372179feb
2 changed files with 18 additions and 1 deletions

17
main.wsgi Normal file
View File

@ -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

2
web.py
View File

@ -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):