Merge branch 'bottle' into template/prime

This commit is contained in:
Dita Aji Pratama 2026-03-25 12:08:36 +07:00
commit d91c199f21
7 changed files with 41 additions and 42 deletions

View File

@ -1,28 +1,3 @@
title = "CostaPy" title = "CostaPy"
menu = {
"public": {
"navbar": [
{
"name":"Home",
"target":"_self",
"href":"/",
"roles":["guest"]
},
{
"name":"About",
"target":"_self",
"href":"/about",
"roles":["guest"]
},
{
"name":"Docs",
"target":"_blank",
"href":"https://costapy.ditaajipratama.net",
"roles":["guest"]
}
]
}
}
copyright = "Copyright (C) 2022 Dita Aji Pratama" copyright = "Copyright (C) 2022 Dita Aji Pratama"

24
config/navigation.py Normal file
View File

@ -0,0 +1,24 @@
menu = {
"public": {
"navbar": [
{
"name":"Home",
"target":"_self",
"href":"/",
"roles":["guest"]
},
{
"name":"About",
"target":"_self",
"href":"/about",
"roles":["guest"]
},
{
"name":"Docs",
"target":"_blank",
"href":"https://costapy.ditaajipratama.net",
"roles":["guest"]
}
]
}
}

4
config/placeholder.py Normal file
View File

@ -0,0 +1,4 @@
image = {
"favicon" : "https://ditaajipratama.net/img/no-profile-donut.png",
"profile" : "https://ditaajipratama.net/img/no-profile-donut.png"
}

View File

@ -2,16 +2,16 @@ from bottle import response
host = "localhost" host = "localhost"
port = 11000 port = 11000
reloader = False reloader = True
debug = False debug = False
server = 'gunicorn' # default = 'wsgiref' server = 'wsgiref' # try 'gunicorn'
session_opts = { session_opts = {
'session.type': 'file', 'session.type': 'file',
'session.cookie_expires': 5*60, # Session expiration in seconds: minutes*seconds 'session.cookie_expires': 5*60, # Session expiration in seconds: minutes*seconds
'session.data_dir': './.beaker/data', 'session.data_dir': './.beaker/data',
'session.auto': True 'session.auto': True
} } # beaker's session options
def enable_cors(): def enable_cors():
response.headers['Access-Control-Allow-Origin' ] = '*' response.headers['Access-Control-Allow-Origin' ] = '*'

View File

@ -1,12 +0,0 @@
python3 -m venv .venv # Create .venv
.venv/bin/pip3 install --upgrade pip # Upgrade pip
.venv/bin/pip3 install bottle # Micro Framework
.venv/bin/pip3 install gunicorn # WSGI Server Backend
.venv/bin/pip3 install beaker # Session & caching library
.venv/bin/pip3 install mako # Template library
.venv/bin/pip3 install mysql-connector # Database connector
.venv/bin/pip3 install bcrypt # Password hash
.venv/bin/pip3 install pyjwt[crypto] # JWT

View File

@ -1,5 +1,5 @@
from mako.template import Template from mako.template import Template
from config import globalvar from config import globalvar, navigation
class main: class main:
@ -11,7 +11,7 @@ class main:
title = globalvar.title, title = globalvar.title,
header = "Welcome to CostaPy", header = "Welcome to CostaPy",
navbar = Template(params["mako"]["website"]['navbar']).render( navbar = Template(params["mako"]["website"]['navbar']).render(
menu = globalvar.menu['public']['navbar'], menu = navigation.menu['public']['navbar'],
user_roles = ["guest"], user_roles = ["guest"],
active_page = "Home" active_page = "Home"
), ),

8
requirements.txt Normal file
View File

@ -0,0 +1,8 @@
bottle
gunicorn
beaker
mako
mysql-connector
bcrypt
pyjwt[crypto]