costapy/modules/public/home.py

30 lines
1.4 KiB
Python
Raw Normal View History

2026-02-11 10:40:40 +07:00
import mysql.connector as mariadb
from config import database, globalvar, navigation
from mako.template import Template
2022-03-16 11:06:52 +07:00
class main:
2024-01-13 12:01:14 +07:00
def __init__(self):
2026-02-11 10:40:40 +07:00
self.db_main = mariadb.connect(**database.db_main)
self.cursor = self.db_main.cursor(dictionary=True)
2022-03-16 11:06:52 +07:00
2024-01-13 12:01:14 +07:00
def html(self, params):
2026-02-11 10:40:40 +07:00
self.cursor.execute("SELECT `favicon`, `copyright` FROM `metaprofile` WHERE id = 1 ;")
metaprofile = self.cursor.fetchone()
2024-06-05 23:27:52 +07:00
return Template(params["mako"]["website"]['index']).render(
2024-01-13 12:01:14 +07:00
title = globalvar.title,
2024-06-05 23:27:52 +07:00
header = "Welcome to CostaPy",
navbar = Template(params["mako"]["website"]['navbar']).render(
2025-06-04 12:09:08 +07:00
menu = navigation.menu['public']['navbar'],
2024-01-13 12:01:14 +07:00
user_roles = ["guest"],
active_page = "Home"
),
footer = Template(params["mako"]["website"]['footer']).render(
2026-02-11 10:40:40 +07:00
copyright = metaprofile["copyright"],
2024-01-13 12:01:14 +07:00
),
container = Template(params["mako"]["website"]['container']).render(
2024-06-05 23:27:52 +07:00
greeting = f"Welcome to your new web application! This placeholder page is here to let you know that your web framework is successfully set up and ready to go. Now, it's time to start building your project. Dive into the documentation to explore the features and capabilities at your disposal."
2024-01-13 12:01:14 +07:00
)
2022-03-16 11:06:52 +07:00
)