mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2024-11-23 08:13:01 +00:00
API: poetry upgrade
This commit is contained in:
parent
b0766933b0
commit
61ad59e90a
6 changed files with 820 additions and 633 deletions
|
@ -1,3 +0,0 @@
|
||||||
from .app import app
|
|
||||||
|
|
||||||
__all__ = ["app"]
|
|
|
@ -21,10 +21,9 @@ app = FastAPI(
|
||||||
redoc_url=SETTINGS.redoc_url,
|
redoc_url=SETTINGS.redoc_url,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
app.include_router(router)
|
||||||
|
|
||||||
@app.on_event("startup")
|
if SETTINGS.production_mode:
|
||||||
async def add_middlewares() -> None:
|
|
||||||
if SETTINGS.production_mode:
|
|
||||||
# Mount frontend in production mode
|
# Mount frontend in production mode
|
||||||
app.mount(
|
app.mount(
|
||||||
path="/",
|
path="/",
|
||||||
|
@ -35,18 +34,13 @@ async def add_middlewares() -> None:
|
||||||
name="frontend",
|
name="frontend",
|
||||||
)
|
)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Allow CORS in debug mode
|
# Allow CORS in debug mode
|
||||||
app.add_middleware(
|
app.add_middleware(
|
||||||
CORSMiddleware,
|
CORSMiddleware,
|
||||||
allow_origins=[
|
|
||||||
"*",
|
|
||||||
],
|
|
||||||
allow_credentials=True,
|
allow_credentials=True,
|
||||||
|
allow_origins=["*"],
|
||||||
allow_methods=["*"],
|
allow_methods=["*"],
|
||||||
allow_headers=["*"],
|
allow_headers=["*"],
|
||||||
expose_headers=["*"],
|
expose_headers=["*"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
app.include_router(router)
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ def main() -> None:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
uvicorn.run(
|
uvicorn.run(
|
||||||
app="advent22_api:app",
|
app="advent22_api.app:app",
|
||||||
host="0.0.0.0",
|
host="0.0.0.0",
|
||||||
port=8000,
|
port=8000,
|
||||||
reload=not SETTINGS.production_mode,
|
reload=not SETTINGS.production_mode,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
from pydantic import BaseModel, BaseSettings
|
from pydantic import BaseModel
|
||||||
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||||
|
|
||||||
|
|
||||||
class DavSettings(BaseModel):
|
class DavSettings(BaseModel):
|
||||||
|
@ -30,6 +31,12 @@ class Settings(BaseSettings):
|
||||||
Per-run settings.
|
Per-run settings.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
model_config = SettingsConfigDict(
|
||||||
|
env_file=".env",
|
||||||
|
env_file_encoding="utf-8",
|
||||||
|
env_nested_delimiter="__",
|
||||||
|
)
|
||||||
|
|
||||||
#####
|
#####
|
||||||
# general settings
|
# general settings
|
||||||
#####
|
#####
|
||||||
|
@ -54,10 +61,5 @@ class Settings(BaseSettings):
|
||||||
cache_ttl: int = 30
|
cache_ttl: int = 30
|
||||||
config_filename: str = "config.toml"
|
config_filename: str = "config.toml"
|
||||||
|
|
||||||
class Config:
|
|
||||||
env_file = ".env"
|
|
||||||
env_file_encoding = "utf-8"
|
|
||||||
env_nested_delimiter = "__"
|
|
||||||
|
|
||||||
|
|
||||||
SETTINGS = Settings()
|
SETTINGS = Settings()
|
||||||
|
|
1367
api/poetry.lock
generated
1367
api/poetry.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -9,19 +9,18 @@ name = "advent22_api"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[tool.poetry.dependencies]
|
[tool.poetry.dependencies]
|
||||||
fastapi = "^0.85.0"
|
Pillow = "^10.0.0"
|
||||||
python = "^3.10"
|
|
||||||
uvicorn = {extras = ["standard"], version = "^0.18.3"}
|
|
||||||
Pillow = "^9.2.0"
|
|
||||||
numpy = "^1.23.3"
|
|
||||||
webdavclient3 = "3.14.5"
|
|
||||||
async-cache = "^1.1.1"
|
async-cache = "^1.1.1"
|
||||||
|
fastapi = "^0.103.1"
|
||||||
|
numpy = "^1.25.2"
|
||||||
|
python = "^3.11"
|
||||||
tomli = "^2.0.1"
|
tomli = "^2.0.1"
|
||||||
|
uvicorn = {extras = ["standard"], version = "^0.23.2"}
|
||||||
[tool.poetry.dev-dependencies]
|
webdavclient3 = "^3.14.6"
|
||||||
|
pydantic-settings = "^2.0.3"
|
||||||
|
|
||||||
[tool.poetry.group.dev.dependencies]
|
[tool.poetry.group.dev.dependencies]
|
||||||
flake8 = "^6.0.0"
|
flake8 = "^6.1.0"
|
||||||
|
|
||||||
[build-system]
|
[build-system]
|
||||||
build-backend = "poetry.core.masonry.api"
|
build-backend = "poetry.core.masonry.api"
|
||||||
|
|
Loading…
Reference in a new issue