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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:39:51+00:00 2026-06-09T14:39:51+00:00

INTRO I’ve recently switched to Python, after about 10 years of PHP development and

  • 0

INTRO

I’ve recently switched to Python, after about 10 years of PHP development and habits.

Eg. in Symfony2, every request to server (Apache for instance) has to load eg. container class and instantiate it, to construct the “rest” of the objects.

As far as I understand (I hope) Python’s WSGI env, an app is created once, and until that app closes, every request just calls methods/functions.

This means that I can have eg. one instance of some class, that can be accessed every time, request is dispatched, without having to instantiate it in every request. Am I right?

QUESTION

I want to have one instance of class since the call to __init__ is very expensive (in both computing and resources lockup). In PHP instantiating this in every request degrades performance, am I right that with Python’s WSGI I can instantiate this once, on app startup, and use through requests? If so, how do I achieve this?

  • 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-06-09T14:39:52+00:00Added an answer on June 9, 2026 at 2:39 pm

    The best method I found was mentioned (and I missed it earlier) in Pyramid docs:

    From Pyramid Docs#Startup

    Note that an augmented version of the values passed as **settings to the Configurator constructor will be available in Pyramid view callable code as request.registry.settings. You can create objects you wish to access later from view code, and put them into the dictionary you pass to the configurator as settings. They will then be present in the request.registry.settings dictionary at application runtime.

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

Sidebar

Related Questions

Brief intro about my requirement. I have an empty JSF dataTable. Now, when I
Intro: I've seen lots of topics here on SO about software testing and other
INTRO I have a TCP/HTTP server that supports plugins in form of Shared Libraries
I have a flash intro for my website and I want after the flash
Boring intro: I know - DDD isn't about technology. As i see it -
Intro: I am working on a car dealer project.. sells every brand of cars
###Intro After puzzling over my code for a while, I discovered that exceptions don't
Intro I have an issue with the SqlClient in .Net 4.0.30319 SP1Rel, in which
Intro I work in a facility where we have microscopes. These guys can be
Intro Let me apologise upfront for the long question. It is as short as

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.