diff --git a/.dockerignore b/.dockerignore index 05d06cc..391fc66 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,7 @@ terraform/ .idea/ .vscode/ **/.venv/ -**/static/ +alloydflanagan/static/* +!alloydflanagan/static/.keep **/.DS_Store **/.env* diff --git a/.github/workflows/fly-preview.yml b/.github/workflows/fly-preview.yml new file mode 100644 index 0000000..57edb82 --- /dev/null +++ b/.github/workflows/fly-preview.yml @@ -0,0 +1,35 @@ +name: Deploy Review App +on: + # Run this workflow on every PR event. Existing review apps will be updated when the PR is updated. + pull_request: + types: [opened, reopened, synchronize, closed] + +env: + FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} + # Set these to your Fly.io organization and preferred region. + FLY_REGION: iad + FLY_ORG: personal + +jobs: + review_app: + runs-on: ubuntu-latest + outputs: + url: ${{ steps.deploy.outputs.url }} + # Only run one deployment at a time per PR. + concurrency: + group: pr-${{ github.event.number }} + + # Deploying apps with this "review" environment allows the URL for the app to be displayed in the PR UI. + # Feel free to change the name of this environment. + environment: + name: review + # The script in the `deploy` sets the URL output for each review app. + url: ${{ steps.deploy.outputs.url }} + steps: + - name: Get code + uses: actions/checkout@v4 + + - name: Deploy PR app to Fly.io + id: deploy + uses: superfly/fly-pr-review-apps@1.2.1 + diff --git a/.gitignore b/.gitignore index 4f10287..bd85848 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ +# NOTE: see also app/.gitignore __pycache__/ .idea/ .DS_Store -secrets.txt +**/.env* # directories w/files from old website /public/ diff --git a/Dockerfile b/Dockerfile index 63dccdc..ef78253 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,7 +24,8 @@ EXPOSE 8080 # 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE" # command. ENV PYTHONUNBUFFERED=1 \ - PORT=8080 + PORT=8080 \ + DJANGO_SETTINGS_MODULE=alloydflanagan.settings.production # Use /app folder as a directory where the source code is stored. WORKDIR /app @@ -33,8 +34,8 @@ WORKDIR /app COPY app /app/ #TODO: get uv to use system python instead of downloading -- faster, more reliable. -RUN pip install --no-cache-dir uv==0.7.13 && \ - uv sync --frozen +RUN pip install --no-cache-dir uv==0.7.17 && \ + uv sync --frozen --no-dev # Note: Fly automatically sets DATABASE_URL CMD ["make", "run-server"] diff --git a/app/.gitignore b/app/.gitignore index a38f2c3..493a0eb 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1,5 +1,9 @@ # files collected by manage.py collectstatic -static/ +/static/* +!/static/.keep + +media/* +!media/.keep # yarn pnp files .pnp.* diff --git a/app/Makefile b/app/Makefile index ae89ad0..dd57745 100644 --- a/app/Makefile +++ b/app/Makefile @@ -2,7 +2,7 @@ PYTHON=uv run --link-mode=copy python run-server: $(PYTHON) manage.py migrate - $(PYTHON) manage.py collectstatic + $(PYTHON) manage.py collectstatic --no-input uv run gunicorn --timeout 30 alloydflanagan.wsgi:application --log-file - djhtml: diff --git a/app/alloydflanagan/home/models.py b/app/alloydflanagan/home/models.py index 637a458..b960155 100644 --- a/app/alloydflanagan/home/models.py +++ b/app/alloydflanagan/home/models.py @@ -17,7 +17,7 @@ class HomePage(Page): ('text', RichTextBlock()), #probably will use custom type later ('image', ImageChooserBlock()), ('header', HeaderBlock()), - ], use_json_field=True, blank=True) + ], blank=True) content_panels = Page.content_panels + [ FieldPanel("intro", classname="full"), diff --git a/app/alloydflanagan/search/views.py b/app/alloydflanagan/search/views.py index 703c4dd..5c8b3d4 100644 --- a/app/alloydflanagan/search/views.py +++ b/app/alloydflanagan/search/views.py @@ -2,7 +2,7 @@ from django.template.response import TemplateResponse from wagtail.models import Page -from wagtail.search.models import Query +from wagtail.contrib.search_promotions.models import Query def search(request): diff --git a/app/alloydflanagan/settings/base.py b/app/alloydflanagan/settings/base.py index 39245de..8c30d94 100644 --- a/app/alloydflanagan/settings/base.py +++ b/app/alloydflanagan/settings/base.py @@ -29,6 +29,7 @@ "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", + "wagtail.contrib.search_promotions", "django.contrib.staticfiles", "wagtail.contrib.forms", "wagtail.contrib.redirects", diff --git a/app/alloydflanagan/settings/production.py b/app/alloydflanagan/settings/production.py index 9ca4ed7..5a9a7c3 100644 --- a/app/alloydflanagan/settings/production.py +++ b/app/alloydflanagan/settings/production.py @@ -6,3 +6,5 @@ from .local import * except ImportError: pass + +SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY') diff --git a/app/alloydflanagan/static/.keep b/app/alloydflanagan/static/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/media/.keep b/app/media/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/pyproject.toml b/app/pyproject.toml index df04430..8687671 100644 --- a/app/pyproject.toml +++ b/app/pyproject.toml @@ -14,7 +14,7 @@ dependencies = [ "gunicorn>=23.0.0", "psycopg>=3.2.7", "structlog>=25.3.0", - "wagtail<5.3", + "wagtail<6.1.0", "whitenoise>=6.9.0", ] diff --git a/app/static/.keep b/app/static/.keep new file mode 100644 index 0000000..e69de29 diff --git a/app/uv.lock b/app/uv.lock index d13e3df..36cbb52 100644 --- a/app/uv.lock +++ b/app/uv.lock @@ -57,7 +57,7 @@ requires-dist = [ { name = "gunicorn", specifier = ">=23.0.0" }, { name = "psycopg", specifier = ">=3.2.7" }, { name = "structlog", specifier = ">=25.3.0" }, - { name = "wagtail", specifier = "<5.3" }, + { name = "wagtail", specifier = "<6.1.0" }, { name = "whitenoise", specifier = ">=6.9.0" }, ] @@ -672,6 +672,18 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/6c/e7/dfa82d0bb2b314950e457a755463b429090127ffc0ab9d8d14ef4563ad44/l18n-2021.3-py3-none-any.whl", hash = "sha256:78495d1df95b6f7dcc694d1ba8994df709c463a1cbac1bf016e1b9a5ce7280b9", size = 51534, upload-time = "2021-11-12T09:32:34.296Z" }, ] +[[package]] +name = "laces" +version = "0.1.2" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "django" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/74/9a/9192d6a74e2c6db4f705dd98f56be488e47373172c13f4916aeabc4d68b8/laces-0.1.2.tar.gz", hash = "sha256:3218e09c1889ae5cf3fc7a82f5bb63ec0c7879889b6a9760bfc42323c694b84d", size = 29264, upload-time = "2025-01-14T04:37:34.805Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/60/fe/31f76f5cb2579bdda208aa257ce5482653f22ab1bad3e128fe2f803fa2f1/laces-0.1.2-py3-none-any.whl", hash = "sha256:980cdaf9a31e883a2b8198132e2388931a4eb8814f5bfa5d8bba13ff9f657b7c", size = 22462, upload-time = "2025-01-14T04:37:30.636Z" }, +] + [[package]] name = "lazy-object-proxy" version = "1.11.0" @@ -1275,7 +1287,7 @@ wheels = [ [[package]] name = "wagtail" -version = "5.2" +version = "6.0.6" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "anyascii" }, @@ -1290,15 +1302,16 @@ dependencies = [ { name = "draftjs-exporter" }, { name = "html5lib" }, { name = "l18n" }, + { name = "laces" }, { name = "openpyxl" }, { name = "pillow" }, { name = "requests" }, { name = "telepath" }, { name = "willow", extra = ["heif"] }, ] -sdist = { url = "https://files.pythonhosted.org/packages/c4/10/8570ddb519455c8a07ac4dd9c95b46aecc5ca2c776a8d0ed143bdf230ea9/wagtail-5.2.tar.gz", hash = "sha256:695b2af9c42ab7b293f489abc9e3dcaa2cbe28977fe0b730683c43b46e0f75d1", size = 6348635, upload-time = "2023-11-01T12:56:04.673Z" } +sdist = { url = "https://files.pythonhosted.org/packages/ee/cf/d97ca7e7bf82e1dede67229d5173bc50969800ab21c2ce2aad44e4a84753/wagtail-6.0.6.tar.gz", hash = "sha256:c00a05eb4cee1e4bbfe7550e30ec121ecdb5143e328d75aaa586b93dff5d1b95", size = 6269592, upload-time = "2024-07-11T10:48:15.825Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/0b/73/b5979b6f325d6d0ccc2842a08c6069fd6fa1a210487be237b98a0761e237/wagtail-5.2-py3-none-any.whl", hash = "sha256:a1d78f99d33ade5ac3ce7dca92f570f28513214d4e203421813ba544cd38eac2", size = 8960488, upload-time = "2023-11-01T12:55:57.842Z" }, + { url = "https://files.pythonhosted.org/packages/0e/6d/ab208f775de97a926fd0bb2ce332c27e54799cb137404e495fc563c360c3/wagtail-6.0.6-py3-none-any.whl", hash = "sha256:9765fd986b39985cfc8227d0973ada6574c78341d52883b096ee2d89662fad36", size = 8720449, upload-time = "2024-07-11T10:48:11.006Z" }, ] [[package]] diff --git a/docker-compose.yml b/docker-compose.yml index 54ecd75..e0a1fc4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -19,6 +19,7 @@ services: - ./app/yarn.lock:/app/yarn.lock:delegated environment: DATABASE_URL: postgres://wagtail:development@postgres:5432/alloydflanagan + DJANGO_SETTINGS_MODULE: alloydflanagan.settings.dev ports: - "8080:8080"