Declarative Panels Not Being Loaded

8 views
Skip to first unread message

Antony Owino

unread,
Sep 13, 2025, 2:59:59 PM (9 days ago) Sep 13
to pylons-discuss
Hello,

Struggling get to panels executed, i.e. Pyramid renders None instead of panel content. I have the following code in myapp/__init__.py

@event_source
def configure_panels(config):
config.include("pyramid_layout")

@event_source
def configure_views(config):
...

# adds cornice
config.include("cornice")

# adds panels
config.include("pyramid_layout")
from . import panels
config.include("myapp.panels.dashboard")
config.scan(panels)

from . import views
config.scan(views)


def main(global_config, **settings):
"""This function returns a Pyramid WSGI application."""
with Configurator(settings=settings) as config:
# Core view and layout related
...
configure_views(config)
configure_panels(config)
...

Which is supposed to load views and panels but the panels are not executed. 

What works is manually adding a panel in myapp/panels/dashboard/__init__.py i.e.:

def includeme(config):
"""Configure dashboard panels."""
config.include("pyramid_layout")

# !!! This does not work
# I have an empty __init__.py in the panels/dashboard module
config.scan("myapp.panels.dashboard")

# Manual panel addition (only this works)
config.add_panel(
"myapp.panels.dashboard.dashboard.test_panel",
name="test_panel",
renderer="string",
)

I'd really prefer adding the panels declaratively. Thank you all in advance.

__ntny__

Michael Merickel

unread,
Sep 13, 2025, 3:27:00 PM (9 days ago) Sep 13
to pylons-...@googlegroups.com
You don't show the @panel_config but assuming it's within the boundaries of one of your calls to config.scan() then the issue is that pyramid's "scan" function by default scans for "pyramid" decorators and pyramid_layout registers its decorators under the "pyramid_layout" category. This means you should adjust your scan for panels to include that category:

    config.scan("myapp.panels", categories=("pyramid", "pyramid_layout"))



--
You received this message because you are subscribed to the Google Groups "pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pylons-discus...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/pylons-discuss/e1327a42-0360-4182-9b6c-aed2ee6b7139n%40googlegroups.com.

Antony Owino

unread,
Sep 13, 2025, 4:59:35 PM (9 days ago) Sep 13
to pylons-...@googlegroups.com
Ah, thanks so much, that worked like a charm!! Good to know I can pass
in a tuple to Venusian - I missed that while stepping through the
debugger earlier. And thank you for the references.
> You received this message because you are subscribed to a topic in the Google Groups "pylons-discuss" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/pylons-discuss/JyKmAF_xNak/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to pylons-discus...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/pylons-discuss/E3F504D3-54EF-4F4B-B754-B6AA609B44CC%40gmail.com.



--
__ntony__
Reply all
Reply to author
Forward
0 new messages