Questions tagged [wsgi]

Web Server Gateway Interface (WSGI) is a standard for web applications written in Python.

The Web Server Gateway Interface (WSGI) is a simple calling convention for web servers to forward requests to web applications or frameworks written in the programming language. Applications, gateways and servers should use it to ensure interoperability.

WSGI is supported by many web frameworks, including , and .

2494 questions
21
votes
1 answer

Difference between WSGI utilities and Web Servers

I am new to Python and i am not able to understand the server concepts in Python. First of all what is WSGI and what are Wsgiref and Werkzeug and how are they different from CherryPy WSGI Server, Gunicorn, Tornado (HTTP Server via…
ajknzhol
  • 6,322
  • 13
  • 45
  • 72
21
votes
3 answers

WSGI: what's the purpose of start_response function

Could you supply a real-life example of WSGI start_response function? (Web-server provides that function to wsgi application) I can't understand the purpose of introducing the start_response. (I've read like 10 identical texts about the WSGI…
Boris Burkov
  • 13,420
  • 17
  • 74
  • 109
20
votes
2 answers

Sharing static global data among processes in a Gunicorn / Flask app

I have a Flask app running under Gunicorn, using the sync worker type with 20 worker processes. The app reads a lot of data on startup, which takes time and uses memory. Worse, each process loads its own copy, which causes it to take even longer…
Doctor J
  • 5,974
  • 5
  • 44
  • 40
20
votes
2 answers

What does make significant difference of performance between eventlet and gevent?

Those two libraries share the similar philosophy and the similar design decisions as a result. But this popular WSGI benchmark says eventlet is way slower than gevent. What do make their performance so different? As I know key differences between…
minhee
  • 5,688
  • 5
  • 43
  • 81
19
votes
1 answer

What's the difference between uWSGI's socket-timeout/http-timeout/harakiri?

I wrote a simple WSGI application (using Flask) served by uWSGI (i.e. no other HTTP server but uWSGI) which only supports a single PUT route using which clients can upload a file (potentially ~400MB in size), have it processed on the server and then…
Frerich Raabe
  • 90,689
  • 19
  • 115
  • 207
19
votes
3 answers

What's the difference between scgi and wsgi?

What's the difference between these two? Which is better/faster/reliable?
daniels
  • 18,416
  • 31
  • 103
  • 173
19
votes
3 answers

Serving a request from gunicorn

Trying to setup a server on Rackspace.com. Have done the following things: Installed Centos 6.3 Installed Python 2.7 Installed gunicorn using the "Quick Start" on their home page: gunicorn.org/ In the quick start, a "hello world" application…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
19
votes
6 answers

Django: WSGIRequest' object has no attribute 'user' on some pages?

I want to set a cookie if user is logged in or not. My middleware: class UserStatus(object): def process_response(self,request,response): user_status = 1 if request.user.is_authenticated() else 0 max_age = (20)*52*7*24*60*60 # 20…
Yugal Jindle
  • 44,057
  • 43
  • 129
  • 197
19
votes
4 answers

How to make a redirect and keep the query string?

I want to make a redirect and keep what is the query string. Something like self.redirect plus the query parameters that was sent. Is that possible?
Niklas Rosencrantz
  • 25,640
  • 75
  • 229
  • 424
18
votes
1 answer

URL building with Flask and non-unique handler names

Flask provides a url_for function to generate URLs to handlers based on the URL pattern. But this would imply that the handler functions must have unique names across the entire application. Is that correct? Example Module A has a handler index:…
deamon
  • 89,107
  • 111
  • 320
  • 448
18
votes
3 answers

Does my code prevent directory traversal?

Is the following code snippet from a Python WSGI app safe from directory traversal? It reads a file name passed as parameter and returns the named file. file_name = request.path_params["file"] file = open(file_name, "rb") mime_type =…
deamon
  • 89,107
  • 111
  • 320
  • 448
18
votes
2 answers

How does Waitress handle concurrent tasks?

I'm trying to build a python webserver using Django and Waitress, but I'd like to know how Waitress handles concurrent requests, and when blocking may occur. While the Waitress documentation mentions that multiple worker threads are available, it…
evantkchong
  • 2,251
  • 3
  • 14
  • 29
18
votes
1 answer

Gunicorn won't start Flask app because "Application object must be callable"

This is maybe a Python noob question, but after having spent a whole day searching, I couldn't find a solution. I created a simple Flask application, here is an extract of the python_pgfutter_importer/app.py: import os from flask import Flask,…
frinux
  • 2,052
  • 6
  • 26
  • 47
17
votes
3 answers

What are uwsgi threads used for?

I see in a uwsgi.ini file there is a configuration [uwsgi] socket = 127.0.0.1:3031 chdir = /home/foobar/myproject/ wsgi-file = myproject/wsgi.py processes = 4 threads = 2 stats = 127.0.0.1:9191 I understand that each request is served in a…
Anubhav Agarwal
  • 1,982
  • 5
  • 28
  • 40
17
votes
3 answers

httplib CannotSendRequest error in WSGI

I've used two different python oauth libraries with Django to authenticate with twitter. The setup is on apache with WSGI. When I restart the server everything works great for about 10 minutes and then the httplib seems to lock up (see the…
Dave
  • 1,658
  • 3
  • 17
  • 19