openfree commited on
Commit
222fa2c
Β·
verified Β·
1 Parent(s): 0057f4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -13
app.py CHANGED
@@ -1,4 +1,4 @@
1
- from flask import Flask, render_template, request, jsonify, send_from_directory
2
  import os, re, json, sqlite3, logging
3
 
4
  app = Flask(__name__)
@@ -492,7 +492,7 @@ textarea.form-control{min-height:100px;font-family:monospace;resize:vertical;}
492
 
493
  <script>
494
  // Basic configuration
495
- const cats = %s;
496
  const tabs = document.getElementById('tabs');
497
  const content = document.getElementById('content');
498
  let active = "";
@@ -1098,17 +1098,10 @@ window.addEventListener('load', function() {
1098
  # ────────────────────────── 8. MAIN ROUTES ──────────────────────────
1099
  @app.route('/')
1100
  def home():
1101
- # HTML을 직접 λ°˜ν™˜ (ν…œν”Œλ¦Ώ 파일 μž‘μ„± λŒ€μ‹ )
1102
- from string import Template
1103
-
1104
- # μΉ΄ν…Œκ³ λ¦¬ JSON λ°°μ—΄ 생성
1105
- categories_json = json.dumps(list(CATEGORIES.keys()))
1106
-
1107
- # Template 객체 생성 - HTML_TEMPLATE λ‚΄ ${categories} λ¬Έμžμ—΄μ„ λŒ€μ²΄
1108
- template = Template(HTML_TEMPLATE)
1109
- return template.substitute(categories=categories_json)
1110
-
1111
-
1112
 
1113
  # Initialize database on startup
1114
  init_db()
 
1
+ from flask import Flask, render_template_string, request, jsonify
2
  import os, re, json, sqlite3, logging
3
 
4
  app = Flask(__name__)
 
492
 
493
  <script>
494
  // Basic configuration
495
+ const cats = ${categories};
496
  const tabs = document.getElementById('tabs');
497
  const content = document.getElementById('content');
498
  let active = "";
 
1098
  # ────────────────────────── 8. MAIN ROUTES ──────────────────────────
1099
  @app.route('/')
1100
  def home():
1101
+ # HTML ν…œν”Œλ¦Ώμ—μ„œ %% λŒ€μ‹  직접 % 문자λ₯Ό μ‚¬μš©
1102
+ # categories λ³€μˆ˜λ§Œ μ „λ‹¬ν•˜κ³  λ‚˜λ¨Έμ§€λŠ” κ·ΈλŒ€λ‘œ μœ μ§€
1103
+ template = HTML_TEMPLATE.replace('${categories}', json.dumps(list(CATEGORIES.keys())))
1104
+ return template
 
 
 
 
 
 
 
1105
 
1106
  # Initialize database on startup
1107
  init_db()