From dc90644d9e3c3c761bbde74e310b00d3d5139756 Mon Sep 17 00:00:00 2001 From: Melissa Autumn Date: Mon, 18 Dec 2023 16:09:46 -0800 Subject: [PATCH] More pathing fixes --- README.md | 4 ++-- backend/Dockerfile | 5 +++++ backend/alembic.ini.example | 4 ++-- backend/google_credentials.json.example | 16 ---------------- backend/pyproject.toml | 6 +++--- backend/requirements-test.txt | 3 --- backend/scripts/dev-entry.sh | 3 ++- backend/scripts/entry.sh | 2 +- docker-compose.yml | 2 +- 9 files changed, 16 insertions(+), 29 deletions(-) delete mode 100644 backend/google_credentials.json.example delete mode 100644 backend/requirements-test.txt diff --git a/README.md b/README.md index 443ec855e..4bd94da5a 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,10 @@ Run application for development with hot reloading backend and frontend: ```bash cd appointment - pip install -r backend/requirements.txt + pip install . touch backend/src/appointment.db # when using sqlite cp backend/.env.example backend/.env # add your own configuration here - uvicorn --factory backend.src.appointment.main:server --host 0.0.0.0 --port 5000 + uvicorn --factory appointment.main:server --host 0.0.0.0 --port 5000 ``` You can now access the backend at [localhost:5000](http://localhost:5000). diff --git a/backend/Dockerfile b/backend/Dockerfile index b4130e7d3..85e8c9668 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -19,5 +19,10 @@ COPY .env . RUN pip install --upgrade pip RUN pip install .'[deploy]' +# Add this hack to line it up with our dev environment. +# I'll buy whoever fixes this a coffee. +RUN mkdir src +RUN ln -s /app/appointment src/appointment + EXPOSE 5000 CMD ["/bin/sh", "./scripts/dev-entry.sh"] diff --git a/backend/alembic.ini.example b/backend/alembic.ini.example index a3fdec178..19cb0821f 100644 --- a/backend/alembic.ini.example +++ b/backend/alembic.ini.example @@ -2,7 +2,7 @@ [alembic] # path to migration scripts -script_location = src/appointment/migrations +script_location = appointment/migrations # template used to generate migration file names; The default value is %%(rev)s_%%(slug)s # Uncomment the line below if you want the files to be prepended with date and time @@ -12,7 +12,7 @@ file_template = %%(year)d_%%(month).2d_%%(day).2d_%%(hour).2d%%(minute).2d-%%(re # sys.path path, will be prepended to sys.path if present. # defaults to the current working directory. -prepend_sys_path = src/appointment +prepend_sys_path = appointment # timezone to use when rendering the date within the migration file # as well as the filename. diff --git a/backend/google_credentials.json.example b/backend/google_credentials.json.example deleted file mode 100644 index bf231acea..000000000 --- a/backend/google_credentials.json.example +++ /dev/null @@ -1,16 +0,0 @@ -{ - "web": { - "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", - "auth_uri": "https://accounts.google.com/o/oauth2/auth", - "client_id": "some-string.apps.googleusercontent.com", - "client_secret": "SOME-SECRET", - "javascript_origins": [ - "http://allowe-origin-uri" - ], - "project_id": "project-id", - "redirect_uris": [ - "http://allowed-redirect-uri" - ], - "token_uri": "https://oauth2.googleapis.com/token" - } -} diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 5182ecc30..dc8065aef 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -1,12 +1,12 @@ [project] -name = "appointment_backend" +name = "appointment" version = "0.2.0" description = "Backend component to Thunderbird Appointment" requires-python = ">3.11" dynamic = ["dependencies"] [project.scripts] -run-command = "src.appointment.main:cli" +run-command = "appointment.main:cli" [project.urls] homepage = "https://appointment.day" @@ -26,7 +26,7 @@ test = [ "httpx==0.25.1", "pytest==7.4.3", ] -deploy = ['appointment_backend[cli]', 'appointment_backend[db]'] +deploy = ['appointment[cli]', 'appointment[db]'] [tool.setuptools.dynamic] dependencies = { file = ["requirements.txt"] } diff --git a/backend/requirements-test.txt b/backend/requirements-test.txt deleted file mode 100644 index 27c1cf093..000000000 --- a/backend/requirements-test.txt +++ /dev/null @@ -1,3 +0,0 @@ -Faker==20.1.0 -httpx==0.25.1 -pytest==7.4.3 diff --git a/backend/scripts/dev-entry.sh b/backend/scripts/dev-entry.sh index 5c70fe6e0..1425bbd1b 100644 --- a/backend/scripts/dev-entry.sh +++ b/backend/scripts/dev-entry.sh @@ -6,4 +6,5 @@ run-command update-db python -u -m smtpd -n -c DebuggingServer localhost:8050 & # Start up real webserver -uvicorn --factory src.appointment.main:server --reload --host 0.0.0.0 --port 5173 +uvicorn --factory appointment.main:server --reload --host 0.0.0.0 --port 5173 + diff --git a/backend/scripts/entry.sh b/backend/scripts/entry.sh index 22ddedfa8..721b462dd 100644 --- a/backend/scripts/entry.sh +++ b/backend/scripts/entry.sh @@ -2,4 +2,4 @@ run-command update-db -uvicorn --factory src.appointment.main:server --host 0.0.0.0 --port 5000 \ No newline at end of file +uvicorn --factory appointment.main:server --host 0.0.0.0 --port 5000 diff --git a/docker-compose.yml b/docker-compose.yml index bf8d45dc1..a974a7735 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,7 +7,7 @@ services: ports: - 5173:5173 volumes: - - ./backend/src:/app/src + - ./backend/src/appointment:/app/appointment environment: - DATABASE_URL=mysql+mysqldb://tba:tba@mysql:3306/appointment depends_on: