Final push: Correct directory structure and content
This commit is contained in:
@@ -0,0 +1,7 @@
|
|||||||
|
from sqlalchemy import create_engine
|
||||||
|
from sqlalchemy.orm import sessionmaker, declarative_base
|
||||||
|
|
||||||
|
SQLALCHEMY_DATABASE_URL = "postgresql://user:pass@db:5432/notes"
|
||||||
|
engine = create_engine(SQLALCHEMY_DATABASE_URL)
|
||||||
|
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)
|
||||||
|
Base = declarative_base()
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
version: "3.8"
|
||||||
|
services:
|
||||||
|
app:
|
||||||
|
build: .
|
||||||
|
ports: ["8000:8000"]
|
||||||
|
depends_on: [db]
|
||||||
|
db:
|
||||||
|
image: postgres:13
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: user
|
||||||
|
POSTGRES_PASSWORD: pass
|
||||||
|
POSTGRES_DB: notes
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html><head><script src="https://cdn.tailwindcss.com"></script></head><body class="bg-yellow-50 p-10"><h1 class="text-2xl font-bold">旅行地のノート</h1></body></html>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
from fastapi import FastAPI, Request
|
||||||
|
from fastapi.responses import HTMLResponse
|
||||||
|
import uvicorn
|
||||||
|
|
||||||
|
app = FastAPI()
|
||||||
|
|
||||||
|
@app.get("/", response_class=HTMLResponse)
|
||||||
|
def read_root():
|
||||||
|
with open("index.html", "r") as f:
|
||||||
|
return f.read()
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
uvicorn.run(app, host="0.0.0.0", port=8000)
|
||||||
Reference in New Issue
Block a user