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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:05:16+00:00 2026-05-30T07:05:16+00:00

I have one simple program of wsgi. from wsgiref.simple_server import make_server import time def

  • 0

I have one simple program of wsgi.

from wsgiref.simple_server import make_server
import time

def application(environ, start_response):
    response_body = 'Hello World'
    status = '200 OK'

    response_headers = [('Content-Type', 'text/plain'),
                    ('Content-Length', str(len(response_body)))]

    start_response(status, response_headers)

    if environ['PATH_INFO'] != '/favicon.ico':

        print "Time :", int(time.time())
        if int(time.time()) % 2:
            print "Even"
            time.sleep(10)
        else:
            print "Odd"
    return [response_body]

httpd = make_server('localhost', 8000, application)
httpd.serve_forever()

So as per the code if the timestamp is Even then it will send response after 10 second. But if the timestamp is Odd then it will send response directly without sleep.

So my question is if i will send 2 request and if first request will send the request in Even mode then my second request will be serve after completing first one.

I check the solution and found that ‘multiprocesscan solve this problem. I set the apache configuration withmultiprocess. Then I get the response forOddwithout completingEven` request.

I check how to set the multiprocess with make_server method of simple_server module. When I run the python /usr/lib64/python2.7/wsgiref/simple_server.py I get the output and last few lines are

wsgi.errors = <open file '<stderr>', mode 'w' at 0x7f22ba2a1270>
wsgi.file_wrapper = <class wsgiref.util.FileWrapper at 0x1647600>
wsgi.input = <socket._fileobject object at 0x1569cd0>
wsgi.multiprocess = False
wsgi.multithread = True
wsgi.run_once = False
wsgi.url_scheme = 'http'
wsgi.version = (1, 0)

So I was search how to set this make_server multiprocess so make_server can handle more then 1 request if any request is in progress.

Thx in advance.

  • 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-30T07:05:18+00:00Added an answer on May 30, 2026 at 7:05 am

    If you’re using Apache/mod_wsgi than you don’t need the make_server/serve_forever stuff. Apache will handle that for you (as it is the web server). It will handle the processes and run the application callback function.

    Make sure your Apache and mod_wsgi configuration allows multiprocess/multithread. Good reference is available here

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

Sidebar

Related Questions

I have a simple one-to-many relationship. I would like to select rows from the
Suppose i have one simple function in my program. Whenever i call that function
I write a simple program to print a image in JSF.... I have one
I'm doing a simple program regarding methods. But I have one problem. Everything is
Recently I have gone through with one simple threading program, which leads me some
Suppose I have a simple program which takes argument input in one of the
I have found that on one simple program, I was able to add the
I have a very simple program that I am trying to improve performance. One
I have one simple program that's using Qt Framework. It uses QProcess to execute
hello guys i have one simple program which copying itself. Its work great when

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.