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 6660069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:06:33+00:00 2026-05-26T02:06:33+00:00

Each Pyramid application has an associated .ini file that contains its settings. For example,

  • 0

Each Pyramid application has an associated .ini file that contains its settings. For example, a default might look like:

[app:main]
use = egg:MyProject
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
...

I am wondering if it is possible to add your own configuration values in there, and read them at run-time (mostly from a view callable). For instance, I might want to have

[app:main]
blog.title = "Custom blog name"
blog.comments_enabled = true
...

Or is it better to have a separate .ini file and parse it during startup?

  • 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-26T02:06:33+00:00Added an answer on May 26, 2026 at 2:06 am

    Sure you can.

    In your entry point function (main(global_config, **settings) in __init__.py in most cases), your config is accessible in the settings variable.

    For example, in your .ini:

    [app:main]
    blog.title = "Custom blog name"
    blog.comments_enabled = true
    

    In your __init__.py:

    def main(global_config, **settings):
        config = Configurator(settings=settings)
        blog_title = settings['blog.title']
        # you can also access you settings via config
        comments_enabled = config.registry.settings['blog.comments_enabled']
        return config.make_wsgi_app()
    

    According to the latest Pyramid docs, you can access the settings in a view function via request.registry.settings. Also, as far as I know, it will be in event subscribers via event.request.registry.settings.

    Regarding your question about using another file, I’m pretty sure it’s good practice to put all your config in the regular init file, using dotted notation like you did.

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

Sidebar

Related Questions

Each time a python file is imported that contains a large quantity of static
Each business object has a matching object that contains sql calls. I'd like to
Each block representing an entity has an icon to collapse it to its header
Each form in the application has a set of radiobuttons. Once selected, only certain
Each C/C++ library has some amount of headers that should be used with that
Each time I do a commit in Xcode I notice that the AppName.xcodeproj file/bundle
Each year at Thanksgiving, my family has drawn names out of a hat to
Each of my clients can have many todo items and every todo item has
Each page of my site has 10 (almost) identical divs, varying only in the
Each of these variables has an integer value. But this syntax is not valid

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.