Questions tagged [wsgi]
Web Server Gateway Interface (WSGI) is a standard for web applications written in Python.
2,501
questions
226
votes
5
answers
87k
views
What are Flask Blueprints, exactly?
I have read the official Flask documentation on Blueprints and even one or two blog posts on using them.
I've even used them in my web app, but I don't completely understand what they are or how they ...
220
votes
4
answers
187k
views
How many concurrent requests does a single Flask process receive?
I'm building an app with Flask, but I don't know much about WSGI and it's HTTP base, Werkzeug. When I start serving a Flask application with gunicorn and 4 worker processes, does this mean that I can ...
157
votes
5
answers
49k
views
How Python web frameworks, WSGI and CGI fit together
I have a Bluehost account where I can run Python scripts as CGI. I guess it's the simplest CGI, because to run I have to define the following in .htaccess:
Options +ExecCGI
AddType text/html py
...
147
votes
4
answers
31k
views
What are WSGI and CGI in plain English?
Every time I read either WSGI or CGI I cringe. I've tried reading on it before but nothing really has stuck.
What is it really in plain English?
Does it just pipe requests to a terminal and ...
142
votes
5
answers
48k
views
What is the point of uWSGI?
I'm looking at the WSGI specification and I'm trying to figure out how servers like uWSGI fit into the picture. I understand the point of the WSGI spec is to separate web servers like nginx from web ...
117
votes
5
answers
36k
views
Flask vs webapp2 for Google App Engine
I'm starting new Google App Engine application and currently considering two frameworks: Flask and webapp2. I'm rather satisfied with built-in webapp framework that I've used for my previous App ...
109
votes
4
answers
74k
views
What exactly is Werkzeug?
From the official documentation:
Werkzeug is a WSGI utility library for Python.
However, when I run my Flask web application, I notice that the response header from the server contains:
HTTP/1.0 ...
107
votes
8
answers
202k
views
Python : How to parse the Body from a raw email , given that raw email does not have a "Body" tag or anything
It seems easy to get the
From
To
Subject
etc via
import email
b = email.message_from_string(a)
bbb = b['from']
ccc = b['to']
assuming that "a" is the raw-email string which looks something like ...
101
votes
3
answers
65k
views
WSGI vs uWSGi with Nginx [closed]
Could anyone please explain pros/cons when using WSGI VS uWSGI with Nginx.
Currently i am building up a production server for the Django website which i have prepared but unable to decide whether ...
84
votes
4
answers
68k
views
Differences and uses between WSGI, CGI, FastCGI, and mod_python in regards to Python?
I'm just wondering what the differences and advantages are for the different CGI's out there. Which one would be best for python scripts, and how would I tell the script what to use?
75
votes
7
answers
89k
views
'WSGIRequest' object has no attribute 'user' Django admin
When I trying to access the admin page it gives me the following error:
System check identified no issues (0 silenced).
June 21, 2016 - 15:26:14
Django version 1.9.7, using settings '...
74
votes
7
answers
104k
views
Print raw HTTP request in Flask or WSGI
I am debugging a microcontroller I've built which is writing raw HTTP requests line by line. I am using Flask for my backend and I would like to see the entire request as it appears in this format:
...
71
votes
19
answers
142k
views
Target WSGI script cannot be loaded as Python module
I am trying to deploy mod_wsgi with apache to run a django application but I am getting an error 500 internal server error The apache logs shows:
[Thu Jun 23 14:01:47 2011] [error] [client 152.78.95....
66
votes
15
answers
86k
views
How do I stop getting ImportError: Could not import settings 'mofin.settings' when using django with wsgi?
I can't get wsgi to import my settings file for my project 'mofin'.
The list of errors from the apache error log are as follows
mod_wsgi (pid=4001): Exception occurred within WSGI script '/var/www/...
65
votes
4
answers
19k
views
How can I modify Procfile to run Gunicorn process in a non-standard folder on Heroku?
I'm new to heroku and gunicorn so I'm not sure how this works. But I've done some searching and I think I'm close to deploying my Django app (1.5.1). So I know I need a Procfile which has
web: ...
65
votes
16
answers
32k
views
How can I tell whether my Django application is running on development server or not?
How can I be certain that my application is running on development server or not? I suppose I could check value of settings.DEBUG and assume if DEBUG is True then it's running on development server, ...
61
votes
13
answers
35k
views
Django vs other Python web frameworks?
I've pretty much tried every Python web framework that exists, and it took me a long time to realize there wasn't a silver bullet framework, each had its own advantages and disadvantages. I started ...
61
votes
12
answers
108k
views
ImportError: No module named django.core.wsgi Apache + VirtualEnv + AWS + WSGI
I am trying to publish my site on an Amazon's EC2 Instance, and I keep getting a 500 error. I really don't know why.
//Log Files
[Sun Feb 17 23:12:48.066802 2013] mod_wsgi (pid=2102): Target WSGI ...
57
votes
2
answers
41k
views
using Flask and Tornado together?
I am a big fan of Flask - in part because it is simple and in part because has a lot of extensions. However, Flask is meant to be used in a WSGI environment, and WSGI is not a non-blocking, so (I ...
53
votes
5
answers
50k
views
Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a module not included in the server configurationAction 'configtest' failed
I got the below error while I was configuring CKAN DataPusher.
Invalid command 'WSGIScriptAlias', perhaps misspelled or defined by a
module not included in the server configurationAction '...
48
votes
3
answers
31k
views
Make sure only one worker launches the apscheduler event in a pyramid web app running multiple workers
We have a web app made with pyramid and served through gunicorn+nginx. It works with 8 worker threads/processes
We needed to jobs, we have chosen apscheduler. here is how we launch it
from apscheduler....
46
votes
4
answers
50k
views
Your server socket listen backlog is limited to 100 connections
I run a flask app on uwsgi. I use supervisor to manage uwsgi process. I find the log saying that
your server socket listen backlog is limited to 100 connections.
How to overcome 100 connections ...
46
votes
2
answers
22k
views
SSL on Apache2 with WSGI [closed]
I am trying to set up SSL on a Django site I maintain and having a bit of trouble setting up my VirtualHost with SSL. I followed the instructions here but every time I try to restart apache, it tells ...
45
votes
4
answers
27k
views
Multiple mod_wsgi apps on one virtual host directing to wrong app
I'm trying to get two (or more) Django applications set up at subdirectories under the same domain, e.g.:
http://example.com/site1/
http://example.com/site2/
I know that normally this works fine by ...
42
votes
9
answers
15k
views
How do you deploy your WSGI application? (and why it is the best way)
I am deploying a WSGI application. There are many ways to skin this cat. I am currently using apache2 with mod-wsgi, but I can see some potential problems with this.
So how can it be done?
Apache Mod-...
42
votes
6
answers
34k
views
Accessing POST Data from WSGI
I can't seem to figure out how to access POST data using WSGI. I tried the example on the wsgi.org website and it didn't work. I'm using Python 3.0 right now. Please don't recommend a WSGI framework ...
41
votes
2
answers
27k
views
Is there a speed difference between WSGI and FCGI?
From the web I've gleaned that WSGI is a CGI for python web development/frameworks. FCGI seems to be a more generalised gateway for a variety of languages. Don't know the performance difference ...
41
votes
4
answers
29k
views
Flask debug=True does not work when going through uWSGI
I call app.run(debug=True) in my flask file.
and I have it deployed with uWSGI and nginx (I followed these instructions)
uwsgi -s /tmp/uwsgi.sock -w flask_file_name:app -H /path/to/virtual/env --...
41
votes
4
answers
158k
views
104, 'Connection reset by peer' socket error, or When does closing a socket result in a RST rather than FIN?
We're developing a Python web service and a client web site in parallel. When we make an HTTP request from the client to the service, one call consistently raises a socket.error in socket.py, in read:...
41
votes
1
answer
26k
views
How does Django handle multiple requests?
How does Django handles multiple requests in production environment?
Suppose we have one of web server: Apache, Nginx, gunicorn etc.
So do those servers for any request from web browser start new ...
39
votes
5
answers
27k
views
Stop processing Flask route if request aborted
I have a flask REST endpoint that does some cpu-intensive image processing and takes a few seconds to return. Often, this endpoint gets called, then aborted by the client. In these situations I would ...
36
votes
2
answers
3k
views
Do browsers preserve order of inputs with same name on GET/POST?
I have this HTML code with multiple inputs with the same name:
<input type="hidden" value="42" name="authors" />
<input type="hidden" value="13" name="authors" />
<input type="hidden" ...
35
votes
30
answers
122k
views
django.core.exceptions.ImproperlyConfigured: WSGI application 'application' could not be loaded
The scenario is,
I cloned the Django code for OpenShift-V3 from here . When I ran the code with python manage.py runserver, I got this error:
django.core.exceptions.ImproperlyConfigured: WSGI ...
35
votes
3
answers
55k
views
How do I deploy a Flask application in IIS?
Can anyone help me get a Flask application running on IIS 6? I have tried to use isapi-wsgi, but when I visit the Virtual Directory address I get a page that says "The specified module could not be ...
35
votes
2
answers
23k
views
How to solve import errors while trying to deploy Flask using WSGI on Apache2
I am having an issue deploying a flask app on apache2 using wsgi. I have posted the error logs and config files below. I have tried moving things around, renaming them, etc, but all give me an ...
32
votes
1
answer
22k
views
tornado vs wsgi(with gunicorn)
I read this about Tornado:
On the other hand, if you already have a WSGI app and want to run it
on a blazing fast tornado.httpserver.HTTPServer, wraps it with
tornado.wsgi.WSGIContainer. But ...
31
votes
3
answers
31k
views
Fixing broken pipe error in uWSGI with Python
While hitting a REST resource (my_resource) in Python, the uWSGI server is throwing the following error in its log:
SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on ...
30
votes
3
answers
10k
views
Differentiate nginx, haproxy, varnish and uWSGI/Gunicorn [closed]
I am really new to sys admin stuff, and have only provisioned a VPS with nginx(serving the static files) and gunicorn as the web server.
I have lately been reading about different other stuff. I ...
29
votes
9
answers
95k
views
Serving Flask app with waitress on windows
I am able to run a webserver using the following code
from flask import Flask
from waitress import serve
app = Flask(__name__, static_url_path='/static')
...
serve(app, port=8080)
The problem is ...
29
votes
6
answers
20k
views
Setting up Django on AWS Elastic Beanstalk: WSGIPath not found
I've been trying for several days now to set up Django under Amazon Web Services' Elastic Beanstalk. I think the problem I'm hitting is this one:
ERROR - Your WSGIPath refers to a file that does not ...
28
votes
2
answers
61k
views
uWSGI won't reload, restart or let me run service
I have a fairly big issue.
I am very new to uwsgi and am not 100% sure on how to debug this issue but I will give you information on where I am at.
I have previously had sites working on this ...
27
votes
2
answers
8k
views
AWS Elastic Beanstalk - Script timed out before returning headers: application.py
I have an existing Elastic Beanstalk flask app on AWS that occasionally will not initialize and gives the following error:
[Mon Jan 23 10:06:51.550205 2017] [core:error] [pid 7331] [client 127.0.0.1:...
27
votes
2
answers
27k
views
uwsgi options --wsgi-file and --module not recognized
I am trying to run a Django app using uwsgi. Most instructions I have found refer to a "--wsgi-file" and "--module" to specify the application, but "uwsgi" makes no mention of these options, and when ...
27
votes
3
answers
19k
views
What is going on when I set app.wsgi_app = ProxyFix(app.wsgi_app) when running a Flask app on gunicorn?
I built a basic web app using Flask, and was able to run it from a virtual machine using its native http server. I quickly realized that with this set up, requests are blocking (I couldn't make ...
26
votes
4
answers
36k
views
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 ...
26
votes
4
answers
37k
views
Gunicorn Environment Variable Setting
I'm currently having difficulty passing environment variables into Gunicorn for my Django project. I'm on the latest 19.1 version. I have a wsgi.py file like so:
import os
import sys
from django.core....
26
votes
3
answers
22k
views
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 ...
26
votes
2
answers
19k
views
Working with a global singleton in Flask (WSGI), do I have to worry about race conditions? [duplicate]
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 ...
26
votes
2
answers
2k
views
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....
25
votes
8
answers
17k
views
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?