WesternFriend / westernfriend.org

A website for Western Friend (westernfriend.org), a Quaker publication that provides resources and support for Quaker communities and individuals seeking to live out their faith in the world. Western Friend is part of the Religious Society of Friends.
https://westernfriend.org
GNU Affero General Public License v3.0
57 stars 39 forks source link

Add breadcrumbs on deep archive page #191

Closed brylie closed 1 year ago

brylie commented 4 years ago

Consider making it easy for people to get back to the magazine page by adding breadcrumbs to the deep archive page.

werberger commented 1 year ago

Hi @brylie. There are a number of issues I'd be happy to take on such as this one.

However, I'm having trouble getting Docker running properly. I get the containers setup but I think it's hanging in the bootup process. Is this a known issue? - apologies if this question to Discussion or elsewhere?

brylie commented 1 year ago

Can you post the specific error you get when running ‘docker compose up’ from within the ‘app/‘ directory?

werberger commented 1 year ago

I get this warning upon first running the command but believe it should cause any issues:

time="2023-04-05T21:44:38+09:30" level=warning msg="The \"PWD\" variable is not set. Defaulting to a blank string."

then it continues to boot until it seems to hang after printing this:

wf_postgres | 2023-04-05 12:19:39.367 UTC [27] LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.013 s, sync=0.003 s, total=0.043 s; sync files=2, longest=0.002 s, average=0.002 s; distance=0 kB, estimate=0 kB

I left it over night and it had not changed this morning. Am I mis understanding something?

brylie commented 1 year ago

I think you're good to go at that point. Try opening another terminal and continuing the developer steps, such as running migrations.

werberger commented 1 year ago

I had tried that too but didn't mention it after getting this error:

ModuleNotFoundError: No module named 'dj_database_url'

EDIT: with renewed confidence I tried again and realised I hadn't started up the shell in the new terminal. However, ran into this error:

django.db.utils.OperationalError: connection to server at "localhost" (::1), port 5432 failed: FATAL: password authentication failed for user "postgres"

I've tried connecting to the database using the psql command line tool (i.e. 'docker exec -it wf_postgres psql -U postgres'). it worked for wf_postres, but not for wf_pgadmin printing:

H: unknown

brylie commented 1 year ago

I’m not sure what could be going wrong. Can you record a short video showing the following steps in your terminal?

  1. cd into the app/ directory
  2. run ‘docker compose up’
  3. open a second terminal
  4. cd into the app/ directory
  5. run ‘poetry shell && poetry install’
  6. run ‘python manage.py migrate’
  7. run ‘python manage.py runserver’

Those steps work correctly on all of the computers I’ve tried.

werberger commented 1 year ago

Here you are @brylie:

https://www.loom.com/share/04271575370d488b837cce9a2dc047ab

brylie commented 1 year ago

Do you have any other Postgres containers or services running on port 5432? What error do you get when running ‘python manage.py migrate’ without first running ‘docker compose up’? I’m guessing there is a leftover Postgres instance running.

werberger commented 1 year ago

You solved it. Got it running after stopping the rogue Postgres instance. Thanks.

If you want to assign this issue to me I'll give it a go.

brylie commented 1 year ago

@werberger, any status updates or difficulties with this task?

werberger commented 1 year ago

I think the only difficulty is the content migration. I thought that would happen as part of the set up, but seems not to have - Wagtail has nothing but Pages, and pgAdmin has all the tables but no data that I can see.

I looked at the CONTENT_MIGRATION.md but it seems rather complex to me and I haven't had the time to look into it.

Should I simply ignore the migration and manually create enough data to demonstrate the breadcrumbs or am I missing something?

brylie commented 1 year ago

In this case, you can run the management command scaffold_initial_content to give a site scaffolding that will include the magazine index page with a child deep archive page.

python manage.py scaffold_initial_content

The only necessary change is to add a page URL link before the following line

https://github.com/WesternFriend/WF-website/blob/da83148e1cbdc8b9dd2427845a96e79e6bedddf7/app/magazine/templates/magazine/deep_archive_index_page.html#L6

Use the page.get_parent helper to get the parent page of the deep archive page https://docs.wagtail.org/en/stable/reference/pages/model_reference.html#wagtail.models.Page.get_parent

Use the pageurl helper to construct the link to the parent page

https://docs.wagtail.org/en/stable/topics/writing_templates.html#pageurl-tag

werberger commented 1 year ago

Hey @brylie . Appreciate this is probably becoming as frustrating for you as it is for me, but hoping that once I get a PR merged on this project I will be able to clear few a reasonable number for you. It will then have been worth your time investment.

Anyway, I've got the code working but whenever I attempt a commit it is throwing this error:

Poetry could not find a pyproject.toml file in C:...\WF-website or its parents

It does not seem to search within the 'app' directory where the pyproject.toml is located. I have tried a lot of things but cannot get around this. Any ideas?

brylie commented 1 year ago

Can you show a screen recording of the steps you take when that error appears?

brylie commented 1 year ago

Also, consider using an IDE like VSCode to assist with the whole development process and committing, if you aren’t using one already 🙂

werberger commented 1 year ago

I can do a recording but is this sufficient?

image

The same error occurs in the parent directory and without the virtual environment. I have also tried with GIT in Pycharm with the same error.

The pyproject.toml file is within the 'app' directory. wondering if the fact it is not looking in this directory is the issue...

brylie commented 1 year ago

Aha! I found the issue was related to the autohooks package, which runs some hooks on every git commit. I've replaced autohooks with pre-commit and updated the contributing guide.

https://github.com/WesternFriend/WF-website/blob/main/docs/CONTRIBUTING.md#install

Sorry for the difficulty here.

Please save your code and try again in a new branch from the latest main branch.

werberger commented 1 year ago

I've updated my local branch and run the new installation command, seemingly successfully. And although it still cannot find pyproject.toml, it progresses further than before. However, the commit is still not completed.

image

brylie commented 1 year ago

Try running pre-commit install -f to use only the pre-commit hooks and remove the old autohooks.

werberger commented 1 year ago

Thanks Brylie. I had done that multiple times but seems I needed to clone it to an entirely new directory.

Hopefully, after all that it's what you're after. But of course happy to alter as required.

brylie commented 1 year ago

Cheers 🥳

brylie commented 1 year ago

Closing this since it was merged.