Move css to a separate file, serve static files under /static/ route
This commit is contained in:
@@ -9,12 +9,13 @@ import requests
|
||||
import os
|
||||
import urllib.parse
|
||||
|
||||
from bottle import hook, request, route, run, view
|
||||
from bottle import hook, request, route, run, static_file, view
|
||||
|
||||
from config import conf
|
||||
import models
|
||||
from models import Song, AirCast, DoesNotExist
|
||||
|
||||
project_dir = os.path.dirname(__file__)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Util functions
|
||||
@@ -112,6 +113,11 @@ def results_page():
|
||||
start_time=time,
|
||||
end_time = '{:0>2}:00'.format(hour+1))
|
||||
|
||||
@route('/static/<filename>')
|
||||
def serve_static_file(filename):
|
||||
static_root = os.path.join(project_dir, 'static')
|
||||
return static_file(filename, root=static_root)
|
||||
|
||||
@hook('before_request')
|
||||
def set_locale():
|
||||
"""Set the locale for all categories to the first lang in Accept-Language
|
||||
|
||||
Reference in New Issue
Block a user