url_base fix

This commit is contained in:
Ruud
2011-05-28 23:21:58 +02:00
parent 98aafeaec3
commit 05f63405e0
5 changed files with 11 additions and 10 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ def get_session(engine = None):
return scoped_session(sessionmaker(bind = engine))
def get_engine():
return create_engine(Env.get('db_path')+'?check_same_thread=False', echo = False)
return create_engine(Env.get('db_path') + '?check_same_thread=False', echo = False)
def addView(route, func, static = False):
web.add_url_rule(route + ('' if static else '/'), endpoint = route if route else 'index', view_func = func)
+4 -1
View File
@@ -120,7 +120,7 @@ def cmd_couchpotato(base_path, args):
# Create app
from couchpotato import app
api_key = Env.setting('api_key')
url_base = '/' + Env.setting('url_base') if Env.setting('url_base') else ''
url_base = '/' + Env.setting('url_base').lstrip('/') if Env.setting('url_base') else ''
reloader = debug and not options.daemonize
# Basic config
@@ -129,6 +129,9 @@ def cmd_couchpotato(base_path, args):
app.debug = debug
app.secret_key = api_key
app.static_path = url_base + '/static'
app.add_url_rule(app.static_path + '/<path:filename>',
endpoint = 'static',
view_func = app.send_static_file)
# Register modules
app.register_module(web, url_prefix = '%s/' % url_base)
+1 -3
View File
@@ -1,4 +1,4 @@
from couchpotato import addView, get_session
from couchpotato import addView
from couchpotato.environment import Env
from flask.helpers import send_from_directory
import os.path
@@ -28,9 +28,7 @@ class Plugin():
return path
def showStatic(self, file = ''):
dir = os.path.join(self.plugin_path, 'static')
return send_from_directory(dir, file)
def isDisabled(self):
+3 -1
View File
@@ -111,10 +111,11 @@ form {
font-weight: bold;
line-height: 1;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-moz-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,0.5);
box-shadow: 0 1px 3px rgba(0,0,0,0.5);
@@ -134,6 +135,7 @@ form {
background: #4e5969;
padding:10px;
height: 60px;
box-shadow: 0 0 30px rgba(0,0,0,0.1);
-moz-box-shadow: 0 0 30px rgba(0,0,0,0.1);
-webkit-box-shadow: 0 0 30px rgba(0,0,0,0.1);
position: fixed;
+2 -4
View File
@@ -25,11 +25,9 @@
<script type="text/javascript" src="{{ url_for('.static', filename='scripts/block/footer.js') }}"></script>
{% for url in fireEvent('clientscript.get_scripts', as_html = True, single = True) %}
<script type="text/javascript" src="{{ url_for('web.index') }}{{ url }}"></script>
{% endfor %}
<script type="text/javascript" src="{{ url_for('web.index') }}{{ url }}"></script>{% endfor %}
{% for url in fireEvent('clientscript.get_styles', as_html = True, single = True) %}
<link rel="stylesheet" href="{{ url_for('web.index') }}{{ url }}" type="text/css">
{% endfor %}
<link rel="stylesheet" href="{{ url_for('web.index') }}{{ url }}" type="text/css">{% endfor %}
<script type="text/javascript" src="{{ url_for('.static', filename='scripts/page.js') }}"></script>
<script type="text/javascript" src="{{ url_for('.static', filename='scripts/page/wanted.js') }}"></script>