question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wagtail SQL call on none wagtail pages

See original GitHub issue

Hi,

I have included wagtail to my project as a cms system. But I have also some old static pages which also produce allways this SQL call:

SELECT"wagtailcore_site"."id", "wagtailcore_site"."hostname", "wagtailcore_site"."port", "wagtailcore_site"."site_name", "wagtailcore_site"."root_page_id", "wagtailcore_site"."is_default_site", CASEWHEN ("wagtailcore_site"."hostname" = '''127.0.0.1''' AND "wagtailcore_site"."port" = '8000') THEN '0' WHEN ("wagtailcore_site"."hostname" = '''127.0.0.1''' AND "wagtailcore_site"."is_default_site" = 'True') THEN '1' WHEN "wagtailcore_site"."is_default_site" = 'True' THEN '2' ELSE '3' END AS "match", "wagtailcore_page"."id", "wagtailcore_page"."path", "wagtailcore_page"."depth", "wagtailcore_page"."numchild", "wagtailcore_page"."title", "wagtailcore_page"."slug", "wagtailcore_page"."content_type_id", "wagtailcore_page"."live", "wagtailcore_page"."has_unpublished_changes", "wagtailcore_page"."url_path", "wagtailcore_page"."owner_id", "wagtailcore_page"."seo_title", "wagtailcore_page"."show_in_menus", "wagtailcore_page"."search_description", "wagtailcore_page"."go_live_at", "wagtailcore_page"."expire_at", "wagtailcore_page"."expired", "wagtailcore_page"."locked", "wagtailcore_page"."first_published_at", "wagtailcore_page"."last_published_at", "wagtailcore_page"."latest_revision_created_at", "wagtailcore_page"."live_revision_id"FROM "wagtailcore_site" INNER JOIN "wagtailcore_page" ON ("wagtailcore_site"."root_page_id" = "wagtailcore_page"."id") WHERE ("wagtailcore_site"."hostname" = '''127.0.0.1''' OR "wagtailcore_site"."is_default_site" = 'True') ORDER BY "match" ASC | 98,487335358% | 144,35 | SelExpl   | This call takes on my desktop computer (in debug mode with sqlite) 150ms. Is there something wrong? And why is this SQL query also called on a none wagtail page?

Issue Summary

Wagtail is calling SQL queries which I don’t need

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
timmysmallscommented, Jan 16, 2020

@RNCTX I hope I can get back to this soon! This weekend if I’m lucky. I believe what you’re asking for is also what @ababic was referring to. Apart from that, I hope my test refactors have taken away most if not all doubts about the backward compatibility of this new implementation, which I believe was a concern a few months back.

1reaction
gasmancommented, Jan 16, 2020

@RNCTX request._wagtail_site will be undefined if you try to access it before the first call to Site.find_for_request.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error when previewing Wagtail page and getting related inlines
I'm stumped - I don't understand what's different about previewing a Wagtail page compared to viewing it normally. Something odd in modelcluster ...
Read more >
Development — Wagtail Documentation 4.1.1 documentation
This will create a new database called test_wagtail in MySQL and run the tests against it. If you need to use different connection...
Read more >
Release 2.1.3 Torchbox - Wagtail Documentation
Every “page” in Wagtail can call out to its parent or children from ... Important: Ensure that none of your field names are...
Read more >
Creating a Call to Action StreamField in Wagtail ... - YouTube
In this video we'll learn how to create a brand new StreamField using a StructBlock to create a Call to Action section on...
Read more >
PostgreSQL search engine — Wagtail 2.2.2 documentation
Features: Supports all the search features available in Wagtail. Easy to install and adds no external dependency or service. Excellent performance for sites...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found