Update app.py
Browse files
app.py
CHANGED
|
@@ -10,6 +10,9 @@ from huggingface_hub.utils import RepositoryNotFoundError
|
|
| 10 |
from werkzeug.utils import secure_filename
|
| 11 |
|
| 12 |
app = Flask(__name__)
|
|
|
|
|
|
|
|
|
|
| 13 |
DATA_FILE = 'data.json'
|
| 14 |
|
| 15 |
# Настройки Hugging Face
|
|
@@ -134,10 +137,18 @@ def catalog():
|
|
| 134 |
align-items: center;
|
| 135 |
padding: 15px 0;
|
| 136 |
border-bottom: 1px solid #e2e8f0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
}
|
| 138 |
.header h1 {
|
| 139 |
font-size: 1.5rem;
|
| 140 |
font-weight: 600;
|
|
|
|
| 141 |
}
|
| 142 |
.theme-toggle {
|
| 143 |
background: none;
|
|
@@ -411,6 +422,9 @@ def catalog():
|
|
| 411 |
font-size: 0.8rem;
|
| 412 |
padding: 8px;
|
| 413 |
}
|
|
|
|
|
|
|
|
|
|
| 414 |
#cart-button {
|
| 415 |
width: 50px;
|
| 416 |
height: 50px;
|
|
@@ -422,6 +436,7 @@ def catalog():
|
|
| 422 |
<body>
|
| 423 |
<div class="container">
|
| 424 |
<div class="header">
|
|
|
|
| 425 |
<h1>Каталог</h1>
|
| 426 |
<button class="theme-toggle" onclick="toggleTheme()">
|
| 427 |
<i class="fas fa-moon"></i>
|
|
@@ -837,6 +852,19 @@ def admin():
|
|
| 837 |
max-width: 1200px;
|
| 838 |
margin: 0 auto;
|
| 839 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 840 |
h1, h2 {
|
| 841 |
font-weight: 600;
|
| 842 |
margin-bottom: 20px;
|
|
@@ -910,6 +938,10 @@ def admin():
|
|
| 910 |
</head>
|
| 911 |
<body>
|
| 912 |
<div class="container">
|
|
|
|
|
|
|
|
|
|
|
|
|
| 913 |
<h1>Добавление товара</h1>
|
| 914 |
<form method="POST" enctype="multipart/form-data">
|
| 915 |
<input type="hidden" name="action" value="add">
|
|
@@ -1022,6 +1054,12 @@ def download():
|
|
| 1022 |
return "База данных скачана.", 200
|
| 1023 |
|
| 1024 |
if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1025 |
backup_thread = threading.Thread(target=periodic_backup, daemon=True)
|
| 1026 |
backup_thread.start()
|
| 1027 |
try:
|
|
|
|
| 10 |
from werkzeug.utils import secure_filename
|
| 11 |
|
| 12 |
app = Flask(__name__)
|
| 13 |
+
# Настройка для статических файлов
|
| 14 |
+
app.static_folder = 'static'
|
| 15 |
+
app.static_url_path = '/static'
|
| 16 |
DATA_FILE = 'data.json'
|
| 17 |
|
| 18 |
# Настройки Hugging Face
|
|
|
|
| 137 |
align-items: center;
|
| 138 |
padding: 15px 0;
|
| 139 |
border-bottom: 1px solid #e2e8f0;
|
| 140 |
+
position: relative;
|
| 141 |
+
}
|
| 142 |
+
.header-logo {
|
| 143 |
+
height: 50px;
|
| 144 |
+
width: auto;
|
| 145 |
+
max-width: 200px;
|
| 146 |
+
object-fit: contain;
|
| 147 |
}
|
| 148 |
.header h1 {
|
| 149 |
font-size: 1.5rem;
|
| 150 |
font-weight: 600;
|
| 151 |
+
margin-left: 15px;
|
| 152 |
}
|
| 153 |
.theme-toggle {
|
| 154 |
background: none;
|
|
|
|
| 422 |
font-size: 0.8rem;
|
| 423 |
padding: 8px;
|
| 424 |
}
|
| 425 |
+
.header-logo {
|
| 426 |
+
height: 40px;
|
| 427 |
+
}
|
| 428 |
#cart-button {
|
| 429 |
width: 50px;
|
| 430 |
height: 50px;
|
|
|
|
| 436 |
<body>
|
| 437 |
<div class="container">
|
| 438 |
<div class="header">
|
| 439 |
+
<img src="{{ url_for('static', filename='logo.png') }}" alt="Logo" class="header-logo">
|
| 440 |
<h1>Каталог</h1>
|
| 441 |
<button class="theme-toggle" onclick="toggleTheme()">
|
| 442 |
<i class="fas fa-moon"></i>
|
|
|
|
| 852 |
max-width: 1200px;
|
| 853 |
margin: 0 auto;
|
| 854 |
}
|
| 855 |
+
.header {
|
| 856 |
+
display: flex;
|
| 857 |
+
align-items: center;
|
| 858 |
+
padding: 15px 0;
|
| 859 |
+
border-bottom: 1px solid #e2e8f0;
|
| 860 |
+
}
|
| 861 |
+
.header-logo {
|
| 862 |
+
height: 50px;
|
| 863 |
+
width: auto;
|
| 864 |
+
max-width: 200px;
|
| 865 |
+
object-fit: contain;
|
| 866 |
+
margin-right: 15px;
|
| 867 |
+
}
|
| 868 |
h1, h2 {
|
| 869 |
font-weight: 600;
|
| 870 |
margin-bottom: 20px;
|
|
|
|
| 938 |
</head>
|
| 939 |
<body>
|
| 940 |
<div class="container">
|
| 941 |
+
<div class="header">
|
| 942 |
+
<img src="{{ url_for('static', filename='logo.png') }}" alt="Logo" class="header-logo">
|
| 943 |
+
<h1>Админ-панель</h1>
|
| 944 |
+
</div>
|
| 945 |
<h1>Добавление товара</h1>
|
| 946 |
<form method="POST" enctype="multipart/form-data">
|
| 947 |
<input type="hidden" name="action" value="add">
|
|
|
|
| 1054 |
return "База данных скачана.", 200
|
| 1055 |
|
| 1056 |
if __name__ == '__main__':
|
| 1057 |
+
# Создаём папку static, если её нет
|
| 1058 |
+
os.makedirs('static', exist_ok=True)
|
| 1059 |
+
# Предполагаем, что logo.png уже в корне, перемещаем его в static
|
| 1060 |
+
if os.path.exists('logo.png') and not os.path.exists('static/logo.png'):
|
| 1061 |
+
os.rename('logo.png', 'static/logo.png')
|
| 1062 |
+
|
| 1063 |
backup_thread = threading.Thread(target=periodic_backup, daemon=True)
|
| 1064 |
backup_thread.start()
|
| 1065 |
try:
|