Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,11 +1,23 @@
|
|
| 1 |
from fastapi import FastAPI
|
|
|
|
|
|
|
| 2 |
|
| 3 |
app = FastAPI()
|
| 4 |
|
| 5 |
-
|
| 6 |
-
def greet_json():
|
| 7 |
-
return {"Hello": "World!"}
|
| 8 |
-
|
| 9 |
@app.get("/api/ping")
|
| 10 |
def ping():
|
| 11 |
-
return {"ok": True}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
from fastapi import FastAPI
|
| 2 |
+
from fastapi.responses import FileResponse
|
| 3 |
+
from fastapi.staticfiles import StaticFiles
|
| 4 |
|
| 5 |
app = FastAPI()
|
| 6 |
|
| 7 |
+
# API testowe (opcjonalne)
|
|
|
|
|
|
|
|
|
|
| 8 |
@app.get("/api/ping")
|
| 9 |
def ping():
|
| 10 |
+
return {"ok": True}
|
| 11 |
+
|
| 12 |
+
# Pliki statyczne: wszystko z folderu 'static' b臋dzie pod /static/...
|
| 13 |
+
app.mount("/static", StaticFiles(directory="static"), name="static")
|
| 14 |
+
|
| 15 |
+
# Strona g艂贸wna: / -> static/index.html
|
| 16 |
+
@app.get("/")
|
| 17 |
+
def home():
|
| 18 |
+
return FileResponse("static/index.html")
|
| 19 |
+
|
| 20 |
+
# Polityka prywatno艣ci: /polityka-prywatnosci -> static/polityka-prywatnosci.html
|
| 21 |
+
@app.get("/polityka-prywatnosci")
|
| 22 |
+
def privacy():
|
| 23 |
+
return FileResponse("static/polityka-prywatnosci.html")
|