Skip to content

Commit 04c2353

Browse files
authored
Upgrade wagtail 6 (#9)
* Upgrade wagtail to version 6. * Remove uneeded use_json_field from StreamField declaration. * Update import for Query model. * Bump uv version. Don't install dev dependencies. * Add action to deploy PRs to preview app. * Fix name of fly organization. * Ignore local .env* files. * Ensure static directory is present for deploy. * Ensure /app/static and /app/media are present with .keep file. * Ensure DJANGO_SETTINGS_MODULE correct for both dev and production. * Don't ignore static subdirs in docker image, do ignore .env files. * Get SECRET_KEY config setting from environment variable. * Fix collectstatic to not require confirmation.
1 parent b2c5b5c commit 04c2353

File tree

16 files changed

+73
-14
lines changed

16 files changed

+73
-14
lines changed

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ terraform/
55
.idea/
66
.vscode/
77
**/.venv/
8-
**/static/
8+
alloydflanagan/static/*
9+
!alloydflanagan/static/.keep
910
**/.DS_Store
1011
**/.env*

.github/workflows/fly-preview.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Deploy Review App
2+
on:
3+
# Run this workflow on every PR event. Existing review apps will be updated when the PR is updated.
4+
pull_request:
5+
types: [opened, reopened, synchronize, closed]
6+
7+
env:
8+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
9+
# Set these to your Fly.io organization and preferred region.
10+
FLY_REGION: iad
11+
FLY_ORG: personal
12+
13+
jobs:
14+
review_app:
15+
runs-on: ubuntu-latest
16+
outputs:
17+
url: ${{ steps.deploy.outputs.url }}
18+
# Only run one deployment at a time per PR.
19+
concurrency:
20+
group: pr-${{ github.event.number }}
21+
22+
# Deploying apps with this "review" environment allows the URL for the app to be displayed in the PR UI.
23+
# Feel free to change the name of this environment.
24+
environment:
25+
name: review
26+
# The script in the `deploy` sets the URL output for each review app.
27+
url: ${{ steps.deploy.outputs.url }}
28+
steps:
29+
- name: Get code
30+
uses: actions/checkout@v4
31+
32+
- name: Deploy PR app to Fly.io
33+
id: deploy
34+
uses: superfly/[email protected]
35+

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
# NOTE: see also app/.gitignore
12
__pycache__/
23
.idea/
34
.DS_Store
4-
secrets.txt
5+
**/.env*
56

67
# directories w/files from old website
78
/public/

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ EXPOSE 8080
2424
# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE"
2525
# command.
2626
ENV PYTHONUNBUFFERED=1 \
27-
PORT=8080
27+
PORT=8080 \
28+
DJANGO_SETTINGS_MODULE=alloydflanagan.settings.production
2829

2930
# Use /app folder as a directory where the source code is stored.
3031
WORKDIR /app
@@ -33,8 +34,8 @@ WORKDIR /app
3334
COPY app /app/
3435

3536
#TODO: get uv to use system python instead of downloading -- faster, more reliable.
36-
RUN pip install --no-cache-dir uv==0.7.13 && \
37-
uv sync --frozen
37+
RUN pip install --no-cache-dir uv==0.7.17 && \
38+
uv sync --frozen --no-dev
3839

3940
# Note: Fly automatically sets DATABASE_URL
4041
CMD ["make", "run-server"]

app/.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# files collected by manage.py collectstatic
2-
static/
2+
/static/*
3+
!/static/.keep
4+
5+
media/*
6+
!media/.keep
37

48
# yarn pnp files
59
.pnp.*

app/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ PYTHON=uv run --link-mode=copy python
22

33
run-server:
44
$(PYTHON) manage.py migrate
5-
$(PYTHON) manage.py collectstatic
5+
$(PYTHON) manage.py collectstatic --no-input
66
uv run gunicorn --timeout 30 alloydflanagan.wsgi:application --log-file -
77

88
djhtml:

app/alloydflanagan/home/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class HomePage(Page):
1717
('text', RichTextBlock()), #probably will use custom type later
1818
('image', ImageChooserBlock()),
1919
('header', HeaderBlock()),
20-
], use_json_field=True, blank=True)
20+
], blank=True)
2121

2222
content_panels = Page.content_panels + [
2323
FieldPanel("intro", classname="full"),

app/alloydflanagan/search/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from django.template.response import TemplateResponse
33

44
from wagtail.models import Page
5-
from wagtail.search.models import Query
5+
from wagtail.contrib.search_promotions.models import Query
66

77

88
def search(request):

app/alloydflanagan/settings/base.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"django.contrib.contenttypes",
3030
"django.contrib.sessions",
3131
"django.contrib.messages",
32+
"wagtail.contrib.search_promotions",
3233
"django.contrib.staticfiles",
3334
"wagtail.contrib.forms",
3435
"wagtail.contrib.redirects",

app/alloydflanagan/settings/production.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@
66
from .local import *
77
except ImportError:
88
pass
9+
10+
SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY')

0 commit comments

Comments
 (0)