Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 0 additions & 45 deletions .env

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules/
/playwright-report/
/blob-report/
/playwright/.cache/
.env
1 change: 1 addition & 0 deletions .python-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.12
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,13 @@ The input variables, with their default values (some auto generated) are:

Backend docs: [backend/README.md](./backend/README.md).

### Run Backend

- cd backend
- uv sync
- .venv\Scripts\Activate.ps1
- python -m uvicorn app.main:app --reload --host 127.0.0.1 --port 8000

## Frontend Development

Frontend docs: [frontend/README.md](./frontend/README.md).
Expand Down
7 changes: 7 additions & 0 deletions backend/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# FastAPI Project - Backend

## Fast Run

- cd backend
- uv sync
- .venv\Scripts\Activate.ps1
- python -m uvicorn app.main:app --reload --host 127.0.0.1 --port 8000

## Requirements

* [Docker](https://www.docker.com/).
Expand Down
11 changes: 10 additions & 1 deletion backend/app/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,23 @@ def all_cors_origins(self) -> list[str]:
POSTGRES_USER: str
POSTGRES_PASSWORD: str = ""
POSTGRES_DB: str = ""
SUPABASE_DATABASE_URL: str | None = None

@computed_field # type: ignore[prop-decorator]
@property
def SQLALCHEMY_DATABASE_URI(self) -> PostgresDsn:
if self.SUPABASE_DATABASE_URL:
return self.SUPABASE_DATABASE_URL
return PostgresDsn.build(
scheme="postgresql+psycopg",
scheme="postgresql+psycopg2",
username=self.POSTGRES_USER,
password=self.POSTGRES_PASSWORD,
host=self.POSTGRES_SERVER,
port=self.POSTGRES_PORT,
path=self.POSTGRES_DB,
)

# Mail settings
SMTP_TLS: bool = True
SMTP_SSL: bool = False
SMTP_PORT: int = 587
Expand All @@ -89,6 +93,11 @@ def _set_default_emails_from(self) -> Self:
@property
def emails_enabled(self) -> bool:
return bool(self.SMTP_HOST and self.EMAILS_FROM_EMAIL)

@computed_field # type: ignore[prop-decorator]
@property
def supabase_enabled(self) -> bool:
return bool(self.SUPABASE_URL and self.SUPABASE_KEY)

EMAIL_TEST_USER: EmailStr = "test@example.com"
FIRST_SUPERUSER: EmailStr
Expand Down
35 changes: 35 additions & 0 deletions backend/app/core/logging.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""Logging tracebackconfiguration for the application."""

import logging
import sys

from app.core.config import settings


def setup_logging() -> None:
"""Configure application logging."""

# Create formatter
formatter = logging.Formatter(
fmt="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
datefmt="%Y-%m-%d %H:%M:%S"
)

# Configure root logger
root_logger = logging.getLogger()
root_logger.setLevel(getattr(logging, settings.log_level.upper()))

# Console handler
console_handler = logging.StreamHandler(sys.stdout)
console_handler.setFormatter(formatter)
root_logger.addHandler(console_handler)

# Configure specific loggers
logging.getLogger("uvicorn").setLevel(logging.INFO)
logging.getLogger("uvicorn.access").setLevel(logging.INFO)
logging.getLogger("httpx").setLevel(logging.WARNING)


def get_logger(name: str | None = None) -> logging.Logger:
"""Get a logger instance."""
return logging.getLogger(name or __name__)
2 changes: 1 addition & 1 deletion backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies = [
"jinja2<4.0.0,>=3.1.4",
"alembic<2.0.0,>=1.12.1",
"httpx<1.0.0,>=0.25.1",
"psycopg[binary]<4.0.0,>=3.1.13",
"psycopg2-binary<3.0.0,>=2.9.0",
"sqlmodel<1.0.0,>=0.0.21",
"pydantic-settings<3.0.0,>=2.2.1",
"sentry-sdk[fastapi]>=2.0.0,<3.0.0",
Expand Down
Loading
Loading