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
26
votes
3 answers

Python, WSGI, multiprocessing and shared data

I am a bit confused about multiproessing feature of mod_wsgi and about a general design of WSGI applications that would be executed on WSGI servers with multiprocessing ability. Consider the following directive: WSGIDaemonProcess example…
Zaur Nasibov
  • 22,280
  • 12
  • 56
  • 83
26
votes
4 answers

How to perform periodic task with Flask in Python

I've been using Flask to provide a simple web API for my k8055 USB interface board; fairly standard getters and putters, and Flask really made my life a lot easier. But I want to be able to register changes of state as / near when whey happen. For…
Bolster
  • 7,460
  • 13
  • 61
  • 96
25
votes
9 answers

Pros and Cons of different approaches to web programming in Python

I'd like to do some server-side scripting using Python. But I'm kind of lost with the number of ways to do that. It starts with the do-it-yourself CGI approach and it seems to end with some pretty robust frameworks that would basically do all the…
Tomas Sedovic
  • 42,675
  • 9
  • 40
  • 30
25
votes
3 answers

Pass command line parameters to uwsgi script

I'm trying to pass arguments to an example wsgi application, : config_file = sys.argv[1] def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return [b"Hello World %s" % config_file] And run: uwsgi…
Krzysztof Rosiński
  • 1,488
  • 1
  • 11
  • 24
25
votes
6 answers

How to get the version of wsgi_mod which apache used?

I am using ubuntu 12.041 and installed apache through apt-get. I don't know what version of mod_wsgi i am using albeit I google about it. All I found is you can use apachctl to restart you apache and you would get something like "Apache/2.2.2…
Chandler.Huang
  • 873
  • 3
  • 12
  • 24
25
votes
8 answers

Minify HTML output from Flask application with Jinja2 templates

Is there a Flask or Jinja2 configuration flag / extension to automatically minify the HTML output after rendering the template?
Alexander
  • 3,724
  • 8
  • 42
  • 50
25
votes
2 answers

Working with a global singleton in Flask (WSGI), do I have to worry about race conditions?

The hello world demo for Flask is: from flask import Flask app = Flask(__name__) @app.route("/") def hello(): return "Hello World!" if __name__ == "__main__": app.run() What if I modified this like so: from flask import Flask app =…
Buttons840
  • 9,239
  • 15
  • 58
  • 85
24
votes
2 answers

Flask unable to read Authorization header on ElasticBeanstalk

I have deployed a Flask app to AWS ElasticBeanstalk. The app is unable to read the 'Authorization' header in requests. Error log reports: KeyError: 'HTTP_AUTHORIZATION' Error traced to: @application.before_request def before_request(): …
24
votes
2 answers

Web gateway interfaces in Python 3

I've finally concluded that I can no longer afford to just hope the ongoing Py3k/WSGI disasterissues will be resolved anytime soon, so I need to get ready to move on. Unfortunately, my available options don't seem a whole lot better: While I find a…
Nicholas Knight
  • 15,774
  • 5
  • 45
  • 57
24
votes
6 answers

Script timed out before returning headers: wsgi.py on elastic beanstalk

I'm trying to deploy a Django application to Elastic Beanstalk. When I visit the page it never loads. The logs say: Script timed out before returning headers: wsgi.py I can ssh into the server and run manage.py runserver and then curl…
Meistro
  • 3,664
  • 2
  • 28
  • 33
24
votes
3 answers

why not a golang WSGI implementation

We have concurrent issues in Python. These WSGI Servers just do not work that wonderful. I have a look around, get nothing like a Golang written WSGI Server with its goroutines. Any reasons?
fengsp
  • 1,035
  • 1
  • 11
  • 19
23
votes
6 answers

Why should I use WSGI?

Been using mod_python for a while, I read more and more articles about how good WSGI is, without really understanding why. So why should I switch to it? What are the benefits? Is it hard, and is the learning curve worth it?
Bite code
  • 578,959
  • 113
  • 301
  • 329
22
votes
3 answers

Where should WSGIPythonPath point in my virtualenv?

I have a folder called python2.7 inside of lib in the virtual environment. After reading half a dozen tutorials, I can't figure out exactly what I'm suppose to point the WSGIPythonPath to. I've seen some pointing to site-packages but some have been…
user83039
  • 3,047
  • 5
  • 19
  • 31
21
votes
3 answers

Send intermittent status of request before sending actual response

I have a server, which takes few minutes to process a specific request and then responds to it. The client has to keep waiting for the response without knowing when it will complete. Is there a way to let the client know about the processing…
Thirupathi Thangavel
  • 2,418
  • 3
  • 29
  • 49
21
votes
2 answers

Tuning mod_wsgi in daemon mode

I'm running wsgi application on apache mod_wsgi in daemon mode. I have these lines in the configuration WSGIDaemonProcess app processes=2 threads=3 display-name=%{GROUP} WSGIProcessGroup app How do I find the optimal combination/tuning of…
vonPetrushev
  • 5,457
  • 6
  • 39
  • 51