Paweł Łaba commited on
Commit
9eac87f
·
1 Parent(s): c420a2a

zmiany w index

Browse files
Files changed (2) hide show
  1. app.py +4 -4
  2. public/index.html +2 -0
app.py CHANGED
@@ -8,17 +8,17 @@ import os
8
 
9
  app = FastAPI()
10
 
11
- # Obsługa katalogu publicznego
12
- app.mount("/public", StaticFiles(directory="public"), name="public")
13
 
14
  @app.get("/", response_class=HTMLResponse)
15
  async def read_root():
16
- """Wyświetla plik index.html"""
17
  try:
18
  with open("public/index.html", "r") as file:
19
  return HTMLResponse(content=file.read(), status_code=200)
20
  except FileNotFoundError:
21
- raise HTTPException(status_code=404, detail="Plik index.html nie został znaleziony")
 
22
 
23
 
24
  class TicTacToeAI:
 
8
 
9
  app = FastAPI()
10
 
11
+ # Montowanie katalogu publicznego na ścieżce głównej
12
+ app.mount("/", StaticFiles(directory="public"), name="static")
13
 
14
  @app.get("/", response_class=HTMLResponse)
15
  async def read_root():
 
16
  try:
17
  with open("public/index.html", "r") as file:
18
  return HTMLResponse(content=file.read(), status_code=200)
19
  except FileNotFoundError:
20
+ return HTMLResponse(content="Plik index.html nie został znaleziony", status_code=404)
21
+
22
 
23
 
24
  class TicTacToeAI:
public/index.html CHANGED
@@ -4,6 +4,7 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>TikTacToe</title>
 
7
  </head>
8
  <body>
9
  <div class="container">
@@ -34,5 +35,6 @@
34
  });
35
  });
36
  </script>
 
37
  </body>
38
  </html>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>TikTacToe</title>
7
+ <link rel="stylesheet" href="style.css">
8
  </head>
9
  <body>
10
  <div class="container">
 
35
  });
36
  });
37
  </script>
38
+ <script src="script.js"></script>
39
  </body>
40
  </html>