Fixed multiple requests for images

Started adding SQL table layouts
Making package loading prettier
This commit is contained in:
Michał Gdula 2023-01-06 15:47:22 +00:00
parent 625a412c3a
commit 5951baadaf
3 changed files with 9 additions and 7 deletions

View file

@ -14,6 +14,8 @@ class DBmanager():
try: try:
load_dotenv(os.path.join('usr', '.env')) load_dotenv(os.path.join('usr', '.env'))
print("Connecting to MySQL database...")
database = mysql.connector.connect(host=os.environ.get('HOST'), database = mysql.connector.connect(host=os.environ.get('HOST'),
port=os.environ.get('PORT'), port=os.environ.get('PORT'),
database=os.environ.get('DATABASE'), database=os.environ.get('DATABASE'),
@ -23,16 +25,16 @@ class DBmanager():
if database.is_connected(): if database.is_connected():
db_Info = database.get_server_info() db_Info = database.get_server_info()
print("Connected to MySQL Server version: ", db_Info) print("Connected to MySQL Server version:", db_Info)
cursor = database.cursor() cursor = database.cursor()
cursor.execute("select database();") cursor.execute("select database();")
record = cursor.fetchone() record = cursor.fetchone()
print("You're connected to database: ", record) print("Connected to database:", record[0])
except Error as e: except Error as e:
print("Error while connecting to MySQL\n", e) print("Error while connecting to MySQL!\n", e)
sys.exit(1) sys.exit(1)
self.database = database self.database = database

View file

@ -6,13 +6,13 @@ class Sassy():
try: try:
import sass import sass
except ImportError: except ImportError:
print("Error: sass not found") print("Error: libsass not found")
sys.exit(1) sys.exit(1)
path_to_sass = os.path.join('./usr', 'themes', theme, 'style.scss') path_to_sass = os.path.join('usr', 'themes', theme, 'style.scss')
if os.path.exists(path_to_sass): if os.path.exists(path_to_sass):
print("Sass found at: " + path_to_sass) print(f"Theme '{theme}' found at:", path_to_sass)
self.sass = sass self.sass = sass
self.loadTheme(path_to_sass) self.loadTheme(path_to_sass)
else: else:
@ -23,6 +23,6 @@ class Sassy():
with open('static/css/style.css', 'w') as f: with open('static/css/style.css', 'w') as f:
try: try:
f.write(self.sass.compile(filename=theme, output_style='compressed')) f.write(self.sass.compile(filename=theme, output_style='compressed'))
print("Sass compiled successfully to: " + f.name) print("Sass compiled successfully to:", f.name)
except self.sass.CompileError as e: except self.sass.CompileError as e:
print("Error: sass compilation failed:\n", e) print("Error: sass compilation failed:\n", e)

0
packages/sql/users.sql Normal file
View file