Fix port conflict and update Pydantic schemas to remove deprecated orm_mode
This commit is contained in:
parent
f5b6cc6df2
commit
ca3feba815
@ -36,6 +36,5 @@ class TodoResponse(TodoBase):
|
|||||||
updated_at: Optional[datetime] = None
|
updated_at: Optional[datetime] = None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
"""ORM mode config for the TodoResponse schema"""
|
"""Config for the TodoResponse schema"""
|
||||||
orm_mode = True
|
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
@ -35,8 +35,7 @@ class UserResponse(UserBase):
|
|||||||
updated_at: Optional[datetime] = None
|
updated_at: Optional[datetime] = None
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
"""ORM mode config for the UserResponse schema"""
|
"""Config for the UserResponse schema"""
|
||||||
orm_mode = True
|
|
||||||
from_attributes = True
|
from_attributes = True
|
||||||
|
|
||||||
|
|
||||||
|
9
main.py
9
main.py
@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
@ -32,4 +34,9 @@ async def startup():
|
|||||||
create_tables()
|
create_tables()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
uvicorn.run("main:app", host="0.0.0.0", port=8000, reload=True)
|
# Get port from environment variable or use default of 8002
|
||||||
|
# This avoids the conflict with port 8001 which is already in use
|
||||||
|
port = int(os.environ.get("PORT", 8002))
|
||||||
|
host = os.environ.get("HOST", "0.0.0.0")
|
||||||
|
|
||||||
|
uvicorn.run("main:app", host=host, port=port, reload=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user