Move css to a separate file, serve static files under /static/ route

This commit is contained in:
2021-06-03 01:05:12 +02:00
parent 7e81ea0b74
commit 2437a3f26b
3 changed files with 27 additions and 22 deletions

View File

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

19
static/balises.css Normal file
View File

@@ -0,0 +1,19 @@
#results {
border-colapse: collapse;
}
#results td, #results th {
padding-top: 3px;
padding-bottom: 3px;
padding-right:15px;
}
#results tr:hover {
background-color: #eaeaea;
}
#results a {
text-decoration: none;
color: inherit;
}
#results .fa-youtube {
/*color: #ed4337;*/
color: crimson;
}

View File

@@ -2,27 +2,7 @@
<head>
<title>Radio Balises</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
<style>
#results {
border-colapse: collapse;
}
#results td, #results th {
padding-top: 3px;
padding-bottom: 3px;
padding-right:15px;
}
#results tr:hover {
background-color: #eaeaea;
}
#results a {
text-decoration: none;
color: inherit;
}
#results .fa-youtube {
color:red;
}
</style>
<link rel="stylesheet" href="static/balises.css">
</head>
<body>
<form action="/" method="post" id="datetime_form">