Skip to content

Commit

Permalink
Merge pull request #1182 from Metro-Records/hcg/revert-wagtail
Browse files Browse the repository at this point in the history
Revert Wagtail implementation
  • Loading branch information
hancush authored Dec 5, 2024
2 parents 32ea9dc + 71267d0 commit e19e545
Show file tree
Hide file tree
Showing 38 changed files with 414 additions and 2,018 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,7 @@ jobs:
DATABASE_URL: postgis://postgres:postgres@localhost:5432/lametro
SEARCH_URL: http://localhost:9200
run: |
flake8 .
black --check .
cp .env.local.example .env.local
pytest -sv
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ lametro/secrets.py
.env

.venv
media/
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,6 @@ Grab the values for the `AWS_ACCESS_KEY_ID` and the `AWS_SECRET_ACCESS_KEY` and

Now you should be able to start uploading some files!

## Review Apps
This repo is set up to deploy review apps on Heroku, and those pull from the staging database to match the experience of deploying as closely as possible! However, note that in order to prevent unapproved model changes from effecting the staging database, migrations are prevented from running on review apps. So those will still have to be reviewed locally.

### Review apps for Wagtail changes

1. Configure the S3 connection, as documented above.
2. Once a release phase successfully completes, provision an Essential 0 database for your review app.
3. Retrieve the URI from the Credentials tab.
4. Run `export HEROKU_DATABASE_URL=<YOUR URI HERE>`.
5. If needed, run `docker compose run --rm -e DATABASE_URL=${HEROKU_DATABASE_URI} scrapers` to populate initial legislative data.
6. Run `docker compose run --rm -e DATABASE_URL=${HEROKU_DATABASE_URI} app python manage.py load_content` to populate initial CMS content from the version controlled fixtures.

## Adding a new board member

Hooray! A new member has been elected or appointed to the Board of Directors.
Expand Down Expand Up @@ -217,10 +205,9 @@ This will start the Locust web server on http://localhost:8089. For more details
see the [Locust documentation](https://docs.locust.io/en/stable/).

## Review Apps

This repo is set up to deploy review apps on Heroku, and those pull from the staging database to match the experience of deploying as closely as possible! However, note that in order to prevent unapproved model changes from effecting the staging database, migrations are prevented from running on review apps. So those will still have to be reviewed locally.

## Updating the Documentation
## Updating the documentation

To make changes to the documentation, [install Quarto](https://quarto.org/docs/get-started/).

Expand Down
31 changes: 31 additions & 0 deletions councilmatic/minimal_settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""
As part of our build process, we need to run collectstatic from within the
Dockerfile. This is a minimal settings file to enable that one management command
"""

import os

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
STATIC_ROOT = os.path.join(BASE_DIR, "static")
STATIC_URL = "/static/"

INSTALLED_APPS = (
"django.contrib.staticfiles",
"django.contrib.gis",
"opencivicdata.core",
"opencivicdata.legislative",
"lametro",
"councilmatic_core",
"debug_toolbar",
"captcha",
)

HAYSTACK_CONNECTIONS = {
"default": {
"ENGINE": "haystack.backends.elasticsearch7_backend.Elasticsearch7SearchEngine",
"URL": "http://elasticsearch:9200",
"INDEX_NAME": "lametro",
"SILENTLY_FAIL": False,
"BATCH_SIZE": 10,
}
}
27 changes: 3 additions & 24 deletions councilmatic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
REMOTE_ANALYTICS_FOLDER=(str, ""),
GOOGLE_SERVICE_ACCT_API_KEY=(str, ""),
GOOGLE_API_KEY=(str, ""),
WAGTAILADMIN_BASE_URL=(str, "https://boardagendas.metro.net"),
)

# Core Django Settings
Expand Down Expand Up @@ -138,20 +137,6 @@
"template_profiler_panel",
"captcha",
"markdownify.apps.MarkdownifyConfig",
"wagtail.contrib.forms",
"wagtail.contrib.redirects",
"wagtail.contrib.typed_table_block",
"wagtail.embeds",
"wagtail.sites",
"wagtail.users",
"wagtail.snippets",
"wagtail.documents",
"wagtail.images",
"wagtail.search",
"wagtail.admin",
"wagtail",
"modelcluster",
"taggit",
)

try:
Expand All @@ -169,7 +154,6 @@
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
"wagtail.contrib.redirects.middleware.RedirectMiddleware",
)

ROOT_URLCONF = "councilmatic.urls"
Expand Down Expand Up @@ -215,9 +199,6 @@
STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static")

MEDIA_ROOT = os.path.join(BASE_DIR, "media")
MEDIA_URL = "/media/"

# Third Party Keys
RECAPTCHA_PUBLIC_KEY = env("RECAPTCHA_PUBLIC_KEY")
RECAPTCHA_PRIVATE_KEY = env("RECAPTCHA_PRIVATE_KEY")
Expand Down Expand Up @@ -262,9 +243,10 @@
)
from django.core.files.storage import get_storage_class

S3Storage = get_storage_class("storages.backends.s3boto3.S3Boto3Storage")

AWS_QUERYSTRING_AUTH = False
DEFAULT_FILE_STORAGE = "storages.backends.s3boto3.S3Boto3Storage"
COUNCILMATIC_HEADSHOT_STORAGE_BACKEND = get_storage_class(DEFAULT_FILE_STORAGE)
COUNCILMATIC_HEADSHOT_STORAGE_BACKEND = S3Storage()

else:
print("AWS not configured. Defaulting to local storage...")
Expand Down Expand Up @@ -356,6 +338,3 @@ def custom_sampler(ctx):

# Hard time limit on HTTP requests
REQUEST_TIMEOUT = 5

WAGTAIL_SITE_NAME = "boardagendas.metro.net"
WAGTAILADMIN_BASE_URL = env("WAGTAILADMIN_BASE_URL")
12 changes: 3 additions & 9 deletions councilmatic/urls.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
from django.conf import settings
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
from django.views.static import serve
from django.views.decorators.cache import never_cache

from haystack.query import EmptySearchQuerySet

from wagtail.admin import urls as wagtailadmin_urls
from wagtail import urls as wagtail_urls
from wagtail.documents import urls as wagtaildocs_urls

from councilmatic_core.views import (
CouncilmaticSearchForm,
)
Expand All @@ -28,6 +23,7 @@
LAMetroEventDetail,
LABillDetail,
LABoardMembersView,
LAMetroAboutView,
LACommitteeDetailView,
LACommitteesView,
LAPersonDetailView,
Expand Down Expand Up @@ -67,6 +63,7 @@
),
url(r"^archive-search", LAMetroArchiveSearch.as_view(), name="archive-search"),
url(r"^$", never_cache(LAMetroIndexView.as_view()), name="index"),
url(r"^about/$", LAMetroAboutView.as_view(), name="about"),
url(
r"^board-report/(?P<slug>[^/]+)/$",
LABillDetail.as_view(),
Expand Down Expand Up @@ -132,12 +129,9 @@
name="lametro_ses_endpoint",
),
path("smartlogic/", include("smartlogic.urls", namespace="smartlogic")),
path("cms/", include(wagtailadmin_urls)),
path("documents/", include(wagtaildocs_urls)),
path("", include(wagtail_urls)),
url(r"", include("councilmatic_core.urls")),
url(r"^test-logging/$", test_logging, name="test_logging"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
]

if settings.DEBUG:
import debug_toolbar
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ services:
DATABASE_URL: 'postgis://postgres:postgres@postgres/lametro'
SHARED_DB: "True"
OCD_DIVISION_CSV: '/app/lametro_divisions.csv'
command: sh -c 'pupa update --rpm=600 lametro people && pupa update --rpm=600 lametro bills window=7 && pupa update --rpm=600 lametro events window=7'
command: sh -c 'pupa update --rpm=600 lametro people && pupa update --rpm=600 lametro bills window=14 && pupa update --rpm=600 lametro events window=14'
volumes:
- ./lametro/secrets.py:/app/lametro/secrets.py
- ./data/lametro_divisions.csv:/app/lametro_divisions.csv
Expand Down
66 changes: 0 additions & 66 deletions lametro/blocks.py

This file was deleted.

1,385 changes: 0 additions & 1,385 deletions lametro/fixtures/cms_content.json

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
50 changes: 0 additions & 50 deletions lametro/management/commands/dump_content.py

This file was deleted.

Loading

0 comments on commit e19e545

Please sign in to comment.