mirror of
https://github.com/bellingcat/whisperbox-transcribe.git
synced 2026-06-13 05:58:35 +03:00
refactor: restructure project layout
This commit is contained in:
@@ -3,8 +3,8 @@ from logging.config import fileConfig
|
||||
from alembic import context
|
||||
from sqlalchemy import engine_from_config, pool
|
||||
|
||||
from app.config import settings
|
||||
from app.db.models import Base
|
||||
from app.shared.config import settings
|
||||
from app.shared.db.models import Base
|
||||
|
||||
# this is the Alembic Config object, which provides
|
||||
# access to the values within the .ini file in use.
|
||||
@@ -3,7 +3,7 @@ from typing import Generator
|
||||
from sqlalchemy import create_engine
|
||||
from sqlalchemy.orm import Session, sessionmaker
|
||||
|
||||
from app.config import settings
|
||||
from app.shared.config import settings
|
||||
|
||||
engine = create_engine(settings.DATABASE_URI)
|
||||
|
||||
@@ -6,7 +6,7 @@ from sqlalchemy.dialects.postgresql import UUID
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.orm import Mapped, declarative_mixin, declared_attr
|
||||
|
||||
from app.db.dtos import ArtifactType, JobStatus, JobType
|
||||
from .dtos import ArtifactType, JobStatus, JobType
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
@@ -4,9 +4,9 @@ import pytest
|
||||
from sqlalchemy.orm import Session
|
||||
from sqlalchemy_utils import create_database, database_exists, drop_database
|
||||
|
||||
from app.db.base import SessionLocal, engine, get_session
|
||||
from app.db.models import Base
|
||||
from app.main import app
|
||||
from app.shared.db.base import SessionLocal, engine, get_session
|
||||
from app.shared.db.models import Base
|
||||
from app.web.main import app
|
||||
|
||||
|
||||
def pytest_configure() -> None:
|
||||
|
||||
@@ -2,8 +2,8 @@ from typing import Dict
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from app.config import settings
|
||||
from app.main import app
|
||||
from app.shared.config import settings
|
||||
from app.web.main import app
|
||||
|
||||
client = TestClient(app)
|
||||
|
||||
|
||||
0
app/web/__init__.py
Normal file
0
app/web/__init__.py
Normal file
@@ -5,10 +5,10 @@ from fastapi import APIRouter, Depends, FastAPI, HTTPException, Path
|
||||
from pydantic import AnyHttpUrl, BaseModel
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
import app.db.dtos as dtos
|
||||
import app.db.models as models
|
||||
from app.db.base import get_session
|
||||
from app.utils.security import authenticate_api_key
|
||||
import app.shared.db.dtos as dtos
|
||||
import app.shared.db.models as models
|
||||
from app.shared.db.base import get_session
|
||||
from app.web.security import authenticate_api_key
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
@@ -3,7 +3,7 @@ from hmac import compare_digest
|
||||
from fastapi import Depends, HTTPException
|
||||
from fastapi.security import OAuth2PasswordBearer
|
||||
|
||||
from app.config import settings
|
||||
from app.shared.config import settings
|
||||
|
||||
|
||||
def authenticate_api_key(
|
||||
@@ -6,4 +6,4 @@ set -e
|
||||
alembic upgrade head
|
||||
|
||||
# start app
|
||||
uvicorn app.main:app --reload --host ${HOST:-0.0.0.0} --port ${PORT:-80}
|
||||
uvicorn app.web.main:app --reload --host ${HOST:-0.0.0.0} --port ${PORT:-80}
|
||||
0
app/worker/__init__.py
Normal file
0
app/worker/__init__.py
Normal file
@@ -1,6 +1,6 @@
|
||||
from celery import Celery
|
||||
|
||||
from .config import settings
|
||||
from app.shared.config import settings
|
||||
|
||||
celery = Celery(__name__)
|
||||
|
||||
Reference in New Issue
Block a user