Kgshop commited on
Commit
086f44a
·
verified ·
1 Parent(s): 0e14b8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -18
app.py CHANGED
@@ -16,20 +16,20 @@ import uuid
16
  load_dotenv()
17
 
18
  app = Flask(__name__)
19
- app.secret_key = 'your_unique_secret_key_soola_cosmetics_67890_no_login'
20
  DATA_FILE = 'data.json'
21
 
22
 
23
  SYNC_FILES = [DATA_FILE]
24
 
25
- REPO_ID = "Kgshop/balluu"
26
  HF_TOKEN_WRITE = os.getenv("HF_TOKEN")
27
  HF_TOKEN_READ = os.getenv("HF_TOKEN_READ")
28
 
29
- STORE_ADDRESS = "Рынок дордой , восток кишка , 235 контейнер "
30
 
31
- CURRENCY_CODE = 'KGS'
32
- CURRENCY_NAME = 'Кыргызский сом'
33
 
34
  DOWNLOAD_RETRIES = 3
35
  DOWNLOAD_DELAY = 5
@@ -154,8 +154,6 @@ def load_data():
154
  return data
155
  except FileNotFoundError:
156
  logging.warning(f"Local file {DATA_FILE} not found. Attempting download from HF.")
157
- except json.JSONDecodeError:
158
- logging.error(f"Error decoding JSON in local {DATA_FILE}. File might be corrupt. Attempting download.")
159
 
160
  if download_db_from_hf(specific_file=DATA_FILE):
161
  try:
@@ -176,7 +174,7 @@ def load_data():
176
  logging.error(f"Error decoding JSON in downloaded {DATA_FILE}. Using default.")
177
  return default_data
178
  except Exception as e:
179
- logging.error(f"Unknown error loading downloaded {DATA_FILE}: {e}. Using default.", exc_info=True)
180
  return default_data
181
  else:
182
  logging.error(f"Failed to download {DATA_FILE} from HF after retries. Using empty default data structure.")
@@ -213,7 +211,7 @@ CATALOG_TEMPLATE = '''
213
  <head>
214
  <meta charset="UTF-8">
215
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
216
- <title>Brand_Baaluu - Каталог</title>
217
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
218
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
219
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.2.0/swiper-bundle.min.css">
@@ -311,8 +309,8 @@ CATALOG_TEMPLATE = '''
311
  <div class="container">
312
  <div class="header">
313
  <div class="logo-title-container" style="display: flex; align-items: center; gap: 15px;">
314
- <img src="https://huggingface.co/spaces/Kgshop/baaluu/resolve/main/Screenshot_20250615-131821.png" alt="Brand_Baaluu Logo" style="height: 50px; width: 50px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 8px rgba(244, 114, 182, 0.7), 0 0 15px rgba(219, 39, 119, 0.5);">
315
- <h1>Brand_Baaluu</h1>
316
  </div>
317
  <button class="theme-toggle" onclick="toggleTheme()" aria-label="Переключить тему">
318
  <i class="fas fa-moon"></i>
@@ -848,11 +846,11 @@ ORDER_TEMPLATE = '''
848
  <head>
849
  <meta charset="UTF-8">
850
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
851
- <title>Заказ №{{ order.id }} - Brand_Baaluu</title>
852
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
853
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
854
  <style>
855
- body { font-family: 'Poppins', sans-serif; background: #FFF0F5; color: #4d333f; line-height: 1.6; padding: 20px; }
856
  .container { max-width: 800px; margin: 20px auto; padding: 30px; background: #fff; border-radius: 15px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid #FBCFE8; }
857
  h1 { text-align: center; color: #F472B6; margin-bottom: 25px; font-size: 1.8rem; font-weight: 600; }
858
  h2 { color: #DB2777; margin-top: 30px; margin-bottom: 15px; font-size: 1.4rem; border-bottom: 1px solid #FBCFE8; padding-bottom: 8px;}
@@ -922,9 +920,9 @@ ORDER_TEMPLATE = '''
922
  function sendOrderViaWhatsApp() {
923
  const orderId = '{{ order.id }}';
924
  const orderUrl = `{{ request.url }}`;
925
- const whatsappNumber = "996703550150";
926
 
927
- let message = `Здравствуйте! Хочу подтвердить свой заказ на Brand_Baaluu:%0A%0A`;
928
  message += `*Номер заказа:* ${orderId}%0A`;
929
  message += `*Ссылка на заказ:* ${encodeURIComponent(orderUrl)}%0A%0A`;
930
  message += `Пожалуйста, свяжитесь со мной для уточнения деталей оплаты и доставки.`;
@@ -950,7 +948,7 @@ ADMIN_TEMPLATE = '''
950
  <head>
951
  <meta charset="UTF-8">
952
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
953
- <title>Админ-панель - Brand_Baaluu</title>
954
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
955
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
956
  <style>
@@ -1020,8 +1018,8 @@ ADMIN_TEMPLATE = '''
1020
  <div class="container">
1021
  <div class="header">
1022
  <div class="logo-title-container" style="display: flex; align-items: center; gap: 15px;">
1023
- <img src="https://huggingface.co/spaces/Kgshop/baaluu/resolve/main/Screenshot_20250615-131821.png" alt="Brand_Baaluu Logo" style="height: 50px; width: 50px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 8px rgba(244, 114, 182, 0.7), 0 0 15px rgba(219, 39, 119, 0.5);">
1024
- <h1><i class="fas fa-tools"></i> Админ-панель Brand_Baaluu</h1>
1025
  </div>
1026
  <a href="{{ url_for('catalog') }}" class="button" style="background-color: #EC4899;"><i class="fas fa-store"></i> Перейти в каталог</a>
1027
  </div>
 
16
  load_dotenv()
17
 
18
  app = Flask(__name__)
19
+ app.secret_key = 'your_unique_secret_key_aruuke_optomkz_99999_no_login'
20
  DATA_FILE = 'data.json'
21
 
22
 
23
  SYNC_FILES = [DATA_FILE]
24
 
25
+ REPO_ID = "Kgshop/aruukebase"
26
  HF_TOKEN_WRITE = os.getenv("HF_TOKEN")
27
  HF_TOKEN_READ = os.getenv("HF_TOKEN_READ")
28
 
29
+ STORE_ADDRESS = ""
30
 
31
+ CURRENCY_CODE = 'KZT'
32
+ CURRENCY_NAME = 'Тенге'
33
 
34
  DOWNLOAD_RETRIES = 3
35
  DOWNLOAD_DELAY = 5
 
154
  return data
155
  except FileNotFoundError:
156
  logging.warning(f"Local file {DATA_FILE} not found. Attempting download from HF.")
 
 
157
 
158
  if download_db_from_hf(specific_file=DATA_FILE):
159
  try:
 
174
  logging.error(f"Error decoding JSON in downloaded {DATA_FILE}. Using default.")
175
  return default_data
176
  except Exception as e:
177
+ logging.error(f"Unknown error loading downloaded {DATA_FILE}: {e}.", exc_info=True)
178
  return default_data
179
  else:
180
  logging.error(f"Failed to download {DATA_FILE} from HF after retries. Using empty default data structure.")
 
211
  <head>
212
  <meta charset="UTF-8">
213
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
214
+ <title>Aruuke_optomKZ - Каталог</title>
215
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
216
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
217
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/Swiper/10.2.0/swiper-bundle.min.css">
 
309
  <div class="container">
310
  <div class="header">
311
  <div class="logo-title-container" style="display: flex; align-items: center; gap: 15px;">
312
+ <img src="https://huggingface.co/spaces/Aruuke-almaty/admin/resolve/main/464856221_879152084357535_5878527617319379130_n.jpg" alt="Aruuke_optomKZ Logo" style="height: 50px; width: 50px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 8px rgba(244, 114, 182, 0.7), 0 0 15px rgba(219, 39, 119, 0.5);">
313
+ <h1>Aruuke_optomKZ</h1>
314
  </div>
315
  <button class="theme-toggle" onclick="toggleTheme()" aria-label="Переключить тему">
316
  <i class="fas fa-moon"></i>
 
846
  <head>
847
  <meta charset="UTF-8">
848
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
849
+ <title>Заказ №{{ order.id }} - Aruuke_optomKZ</title>
850
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
851
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
852
  <style>
853
+ body { font-family: 'Poppins', sans-serif; background: #FFF0F5; color: #4d333f; padding: 20px; }
854
  .container { max-width: 800px; margin: 20px auto; padding: 30px; background: #fff; border-radius: 15px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); border: 1px solid #FBCFE8; }
855
  h1 { text-align: center; color: #F472B6; margin-bottom: 25px; font-size: 1.8rem; font-weight: 600; }
856
  h2 { color: #DB2777; margin-top: 30px; margin-bottom: 15px; font-size: 1.4rem; border-bottom: 1px solid #FBCFE8; padding-bottom: 8px;}
 
920
  function sendOrderViaWhatsApp() {
921
  const orderId = '{{ order.id }}';
922
  const orderUrl = `{{ request.url }}`;
923
+ const whatsappNumber = "+77089276224";
924
 
925
+ let message = `Здравствуйте! Хочу подтвердить свой заказ на Aruuke_optomKZ:%0A%0A`;
926
  message += `*Номер заказа:* ${orderId}%0A`;
927
  message += `*Ссылка на заказ:* ${encodeURIComponent(orderUrl)}%0A%0A`;
928
  message += `Пожалуйста, свяжитесь со мной для уточнения деталей оплаты и доставки.`;
 
948
  <head>
949
  <meta charset="UTF-8">
950
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
951
+ <title>Админ-панель - Aruuke_optomKZ</title>
952
  <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
953
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
954
  <style>
 
1018
  <div class="container">
1019
  <div class="header">
1020
  <div class="logo-title-container" style="display: flex; align-items: center; gap: 15px;">
1021
+ <img src="https://huggingface.co/spaces/Aruuke-almaty/admin/resolve/main/464856221_879152084357535_5878527617319379130_n.jpg" alt="Aruuke_optomKZ Logo" style="height: 50px; width: 50px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 8px rgba(244, 114, 182, 0.7), 0 0 15px rgba(219, 39, 119, 0.5);">
1022
+ <h1><i class="fas fa-tools"></i> Админ-панель Aruuke_optomKZ</h1>
1023
  </div>
1024
  <a href="{{ url_for('catalog') }}" class="button" style="background-color: #EC4899;"><i class="fas fa-store"></i> Перейти в каталог</a>
1025
  </div>