Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632193
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:33:37+00:00 2026-05-31T06:33:37+00:00

I’d like to know how to edit pyramid registry at runtime. Well i’m not

  • 0

I’d like to know how to edit pyramid registry at runtime. Well i’m not so sure exactly what I have to edit.

I know I can extend pyramid with config.include(…). But once config.make_wsgi_app() is called, there seems to be no way to add routes or new mako directories. Any change to the registery in threadlocals or settings have no effect on how the app behave.

My goal is to add plugin at runtime. Here’s a use case.

Someone install my appserver running pyramid…then install some plugins

pip install page_plugin

then in /configs

There is a list of installed plugins and you can select which ones are activated or not. Currently I know of only one way to do that:

Using entry_points I can see my plugins and in the main function of pyramid, I can register the plugins. Using a filestorage I could check every plugins states: [install, installed, uninstall, uninstalled, disabled]

That way I can from a view install/uninstall my plugins.

In order to see any change I have to reboot the server.

states
install : will install on next boot
installed: is installed and active
uninstall: will uninstall on next boot
uninstalled: is uninstalled
disabled: not uninstalled but not activated

install/uninstall are used to setup the database if needed

I think there is no real other way to do that since there is no “remove_view”. I could probably make the server reload. And it would load the new configuration.

[EDIT]

There is no function to remove route or antyhing. SO my guess is that realoding the server is probably the easies and simplest way to do it… and it is probably cleaner to reboot the server than forgetting to unload some stuffs from the plugins.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:33:39+00:00Added an answer on May 31, 2026 at 6:33 am

    It is possible to modify the registry at runtime:

    config = Configurator(registry=request.registry)
    config.add_route(...)
    config.commit()
    

    You have to note, however, that modifying the registry is not a thread-safe operation. You would have to synchronize this yourself. Instead of doing this, I would suggest thinking about your problem in a different way and attempting to create routes that encompass the features that you anticipate extending. Routes can accept patterns (even .* if you want the rest of the URL), and there is also traversal which is very very dynamic and easy to extend at runtime.

    Adding removable views is possible, but I wouldn’t do it at the “adding or removing of routes” level. Instead I suggest using custom predicates on your routes that control whether the route is matched or not.

    def is_enabled(info, request):
        return True if route_should_be_enabled else False
    
    config.add_route('my_plugin_head', '/foo/{bar}', custom_predicates=[is_enabled])
    

    In this way, if is_enabled returns False, the route is never matched and is effectively ignored.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
Does anyone know how can I replace this 2 symbol below from the string
I have some data like this: 1 2 3 4 5 9 2 6
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.