From f94259564a67d21e8e6f96491bc472455cabcb98 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 4 Jun 2025 12:00:53 +0700 Subject: [PATCH 1/5] use wsgiref as a default server, enable reloader, and add some comment on the server configuration --- config/server.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/server.py b/config/server.py index 8c191b8..1d959ee 100644 --- a/config/server.py +++ b/config/server.py @@ -2,16 +2,16 @@ from bottle import response host = "localhost" port = 11000 -reloader = False +reloader = True debug = False -server = 'gunicorn' # default = 'wsgiref' +server = 'wsgiref' # try 'gunicorn' session_opts = { 'session.type': 'file', 'session.cookie_expires': 5*60, # Session expiration in seconds: minutes*seconds 'session.data_dir': './.beaker/data', 'session.auto': True -} +} # beaker's session options def enable_cors(): response.headers['Access-Control-Allow-Origin' ] = '*' From dfa0c522478a358229573def1eceb7a1b90ec2f5 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 4 Jun 2025 12:09:08 +0700 Subject: [PATCH 2/5] separate navigation configuration --- config/globalvar.py | 25 ------------------------- config/navigation.py | 24 ++++++++++++++++++++++++ modules/public/home.py | 4 ++-- 3 files changed, 26 insertions(+), 27 deletions(-) create mode 100644 config/navigation.py diff --git a/config/globalvar.py b/config/globalvar.py index 81da8ab..45deed2 100644 --- a/config/globalvar.py +++ b/config/globalvar.py @@ -1,28 +1,3 @@ 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" diff --git a/config/navigation.py b/config/navigation.py new file mode 100644 index 0000000..c4ba852 --- /dev/null +++ b/config/navigation.py @@ -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"] + } + ] + } +} diff --git a/modules/public/home.py b/modules/public/home.py index d9554b2..e137a39 100644 --- a/modules/public/home.py +++ b/modules/public/home.py @@ -1,5 +1,5 @@ from mako.template import Template -from config import globalvar +from config import globalvar, navigation class main: @@ -11,7 +11,7 @@ class main: title = globalvar.title, header = "Welcome to CostaPy", navbar = Template(params["mako"]["website"]['navbar']).render( - menu = globalvar.menu['public']['navbar'], + menu = navigation.menu['public']['navbar'], user_roles = ["guest"], active_page = "Home" ), From 4951c2589323bc510ed983bdea6f9872e62fe873 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 15 Oct 2025 21:48:05 +0700 Subject: [PATCH 3/5] Add configuration for a placeholder --- config/placeholder.py | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 config/placeholder.py diff --git a/config/placeholder.py b/config/placeholder.py new file mode 100644 index 0000000..9e08342 --- /dev/null +++ b/config/placeholder.py @@ -0,0 +1,3 @@ +image = { + "profile":"https://ditaajipratama.net/img/no-profile-donut.png" +} From 68e0494f7876aad7fd21756fc249a00c77fc6d09 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Tue, 6 Jan 2026 23:07:00 +0700 Subject: [PATCH 4/5] Now use requirements.txt for pip install --- install.sh | 12 ------------ requirements.txt | 8 ++++++++ 2 files changed, 8 insertions(+), 12 deletions(-) delete mode 100644 install.sh create mode 100644 requirements.txt diff --git a/install.sh b/install.sh deleted file mode 100644 index a8b19a5..0000000 --- a/install.sh +++ /dev/null @@ -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 diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..19df4fa --- /dev/null +++ b/requirements.txt @@ -0,0 +1,8 @@ +bottle +gunicorn +beaker +mako + +mysql-connector +bcrypt +pyjwt[crypto] From ec01874c8c73c689ec2fe7c3573ab1118ee59979 Mon Sep 17 00:00:00 2001 From: Dita Aji Pratama Date: Wed, 25 Mar 2026 12:01:38 +0700 Subject: [PATCH 5/5] Add favicon on placeholder configuration --- config/placeholder.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/placeholder.py b/config/placeholder.py index 9e08342..b5017e2 100644 --- a/config/placeholder.py +++ b/config/placeholder.py @@ -1,3 +1,4 @@ image = { - "profile":"https://ditaajipratama.net/img/no-profile-donut.png" + "favicon" : "https://ditaajipratama.net/img/no-profile-donut.png", + "profile" : "https://ditaajipratama.net/img/no-profile-donut.png" }