Automated Action 06df0285b1 Implement Blogging Platform API with FastAPI and SQLite
- Set up project structure and dependencies
- Create database models for users, posts, comments, and tags
- Set up Alembic for database migrations
- Implement user authentication (register, login)
- Create CRUD endpoints for blog posts, comments, and tags
- Add health check endpoint
- Set up proper error handling
- Update README with project details and setup instructions
2025-06-02 21:58:50 +00:00

32 lines
954 B
Python

from typing import List
from pydantic_settings import BaseSettings
from pydantic import AnyHttpUrl, validator
class Settings(BaseSettings):
API_V1_STR: str = "/api/v1"
PROJECT_NAME: str = "Blogging Platform API"
# CORS Origins
BACKEND_CORS_ORIGINS: List[AnyHttpUrl] = []
@validator("BACKEND_CORS_ORIGINS", pre=True)
def assemble_cors_origins(cls, v: str | List[str]) -> List[str] | str:
if isinstance(v, str) and not v.startswith("["):
return [i.strip() for i in v.split(",")]
elif isinstance(v, (list, str)):
return v
raise ValueError(v)
# JWT Secret Key
SECRET_KEY: str = "09d25e094faa6ca2556c818166b7a9563b93f7099f6f0f4caa6cf63b88e8d3e7"
ALGORITHM: str = "HS256"
# 60 minutes * 24 hours * 7 days = 7 days
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 7
class Config:
case_sensitive = True
env_file = ".env"
settings = Settings()