soiz1 commited on
Commit
b11cea5
·
verified ·
1 Parent(s): 5ae0f46

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -4
app.py CHANGED
@@ -28,17 +28,24 @@ def index():
28
 
29
  @app.route("/<path:filepath>")
30
  def serve_any(filepath):
31
- # staticを先に探す
 
 
32
  static_path = os.path.join(app.static_folder, filepath)
 
33
  if os.path.isfile(static_path):
 
34
  return send_from_directory(app.static_folder, filepath)
35
-
36
- # repo_dir内を探すときは、スペースを含むパスを正しく処理する
37
  full_path = os.path.join(REPO_DIR, filepath)
 
38
  if os.path.isfile(full_path):
39
  directory, filename = os.path.split(full_path)
 
40
  return send_from_directory(directory, filename)
41
-
 
42
  abort(404)
43
 
44
  # 読み取り専用ファイルを削除できるようにする
 
28
 
29
  @app.route("/<path:filepath>")
30
  def serve_any(filepath):
31
+ app.logger.info(f"Request for file: {filepath}")
32
+
33
+ # static フォルダ内のファイルをチェック
34
  static_path = os.path.join(app.static_folder, filepath)
35
+ app.logger.info(f"Checking static path: {static_path}")
36
  if os.path.isfile(static_path):
37
+ app.logger.info(f"Serving from static: {filepath}")
38
  return send_from_directory(app.static_folder, filepath)
39
+
40
+ # REPO_DIR内のファイルをチェック
41
  full_path = os.path.join(REPO_DIR, filepath)
42
+ app.logger.info(f"Checking repo path: {full_path}")
43
  if os.path.isfile(full_path):
44
  directory, filename = os.path.split(full_path)
45
+ app.logger.info(f"Serving from repo: directory={directory}, filename={filename}")
46
  return send_from_directory(directory, filename)
47
+
48
+ app.logger.warning(f"File not found: {filepath}")
49
  abort(404)
50
 
51
  # 読み取り専用ファイルを削除できるようにする