a template staticdir

This commit is contained in:
Dita Aji Pratama 2023-12-15 16:58:00 +07:00
parent eae70284d7
commit a26927848f
11 changed files with 38 additions and 10 deletions

View File

@ -1,24 +1,31 @@
import os
# template import
import templates.basic_bootstrap.main as basic_bootstrap
# pages directory
page = {
'public' :'page/public' ,
'error' :'page/error' # Non-template
}
# public staticdir
dirconfig = {
'/' :
{
'tools.sessions.on' : True ,
'tools.staticdir.root' : os.path.abspath(os.getcwd()) ,
},
'/lib' :
{
'tools.staticdir.on' : True ,
'tools.staticdir.dir' : './static/lib' ,
},
'/css' :
{
'tools.staticdir.on' : True ,
'tools.staticdir.dir' : './static/css' ,
},
}
def add(template):
for row in template:
dirconfig[ row['name'] ] = row['value']
# template staticdir
add(basic_bootstrap.static)

View File

@ -1,7 +1,9 @@
import cherrypy
import json
import config.directory as directory
import templates.basic_bootstrap.main as basic_bootstrap
import modules.public.home as public_home
@cherrypy.tools.accept(media="application/json")

View File

@ -5,10 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>${GV_title}</title>
<script src="${GV_base_url}/lib/jquery/jquery-3.7.0.min.js"></script>
<link href="${GV_base_url}/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="${GV_base_url}/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="${GV_base_url}/css/style.css">
<script src="${GV_base_url}/basic_bootstrap/lib/jquery/jquery-3.7.0.min.js"></script>
<link href="${GV_base_url}/basic_bootstrap/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="${GV_base_url}/basic_bootstrap/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="${GV_base_url}/basic_bootstrap/css/style.css">
</head>
<body class="d-flex flex-column" style="min-height:100vh;">
${topnav}

View File

@ -1,4 +1,22 @@
from core import html
from config import directory
static = [
{
'name':'/basic_bootstrap/lib',
'value':{
'tools.staticdir.on' : True ,
'tools.staticdir.dir' : './templates/basic_bootstrap/static/lib' ,
}
},
{
'name':'/basic_bootstrap/css',
'value':{
'tools.staticdir.on' : True ,
'tools.staticdir.dir' : './templates/basic_bootstrap/static/css' ,
}
}
]
def main(dir, page):

View File

@ -0,0 +1 @@
/* your style here */