mirror of
https://github.com/spl0k/supysonic.git
synced 2024-11-10 04:02:17 +00:00
WSGI script and fix redirect when not logged in
This commit is contained in:
parent
64cbccf9ad
commit
3372179feb
17
main.wsgi
Normal file
17
main.wsgi
Normal 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
2
web.py
@ -28,7 +28,7 @@ def init_and_login_check():
|
|||||||
|
|
||||||
if should_login:
|
if should_login:
|
||||||
flash('Please 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
|
@app.teardown_request
|
||||||
def teardown(exception):
|
def teardown(exception):
|
||||||
|
Loading…
Reference in New Issue
Block a user