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
14
votes
1 answer

Flask hello world using apache and mod_wsgi shows files in webroot only

I'm attempting to run the basic hello.py from the flask site over apache2 using wsgi. Here is what my code looks like: /var/www/flask_dev/hello.py from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello…
David
  • 2,080
  • 5
  • 29
  • 44
14
votes
3 answers

How to access request in Flask Middleware

I want to access request.url in middleware. Flask app - test.py from flask import Flask from middleware import TestMiddleware app = Flask(__name__) app.wsgi_app = TestMiddleware(app.wsgi_app) @app.route('/') def hello_world(): return 'Hello…
rajpy
  • 2,436
  • 5
  • 29
  • 43
14
votes
4 answers

Gunicorn 'ImportError: No module named app.wsgiapp' on heroku

I cannot run gunicorn on heroku with simple flask app. The application is really simple. This is app.py: app = Flask(__name__) @app.route("/") def say_hello(url): return "Hello" if __name__ == "__main__": port = int(os.environ.get('PORT',…
Joseph
  • 3,085
  • 3
  • 23
  • 33
14
votes
1 answer

Is uwsgi protocol faster than http protocol?

I am experimenting with various setups for deploying django apps. My first choice was using a simple apache server with mod_wsgi, which I had implemented before for private use. Since the current deployment is for public use, I am looking at…
Vipul Patil
  • 468
  • 5
  • 17
14
votes
1 answer

(13)Permission denied: mod_wsgi Unable to connect to WSGI

I'm trying to run django 1.3.1 on new vps server (CentOS 6). Right now I'm getting this error: (13)Permission denied: mod_wsgi (pid=7159): Unable to connect to WSGI daemon process 'somodinteriors:80' on '/etc/httpd/logs/wsgi.7152.0.1.sock' after…
miszczu
  • 1,179
  • 4
  • 19
  • 39
13
votes
3 answers

Understanding global object persistence in Python WSGI apps

Consider the following code in my WebApp2 application in Google App Engine: count = 0 class MyHandler(webapp2.RequestHandler): def get(self): global count count = count + 1 print count With each refresh of the page,…
Yarin
  • 173,523
  • 149
  • 402
  • 512
13
votes
10 answers

Django ImproperlyConfigured: WSGI application 'myproject.wsgi.application' could not be loaded; Error importing module

I have an almost fresh install of django and when I run python manage.py runserver. It is giving me this error: ImproperlyConfigured: WSGI application 'myproject.wsgi.application' could not be loaded; Error importing…
tommyp
  • 331
  • 1
  • 3
  • 12
13
votes
0 answers

Flask: How to detect disconnection in infinite response generator?

In flask I have a page that is used with EventSource to receive updates/events. It's implemented in fairly trivial manner: @route('/updates') def updates(): def gen(): while True: update = make_update() yield…
elmo
  • 1,189
  • 1
  • 10
  • 35
13
votes
6 answers

Flask + mod_wsgi automatic reload on source code change

Does anyone know how to make a mod_wsgi automatically reload a Flask app when any of the modules changes? I've tried WSGIScriptReloading On, but no luck. The official documentation is kind of a bear ... I guess I'll give it a stab if no one knows.…
gatoatigrado
  • 16,580
  • 18
  • 81
  • 143
13
votes
3 answers

curl-like tool for wsgi over unix domain socket

Is there a command line tool to send requests directly to a wsgi application (django) listening on a unix socket? An equivalent of: curl -X GET http://example.org/index.html But that would bypass HTTP server and talked directly to the underlying…
Jan Wrobel
  • 6,969
  • 3
  • 37
  • 53
13
votes
2 answers

Could you explain more detailed differences between mod_wsgi and werkzeug? (SOS newbies)

As I stated on the title, I'm currently feeling pretty uncomfortable of basic understanding of them. As far as I know, mod_wsgi implemented WSGI specification which can be run under Apache web server. It was coded in C language. Another one,…
user1713464
  • 131
  • 1
  • 5
13
votes
1 answer

Understanding WSGI

I am trying to understand the functionality of WSGI and need some help. So far I know that it is kind of a middleware between servers and applications, used for interfacing different application frameworks (that reside in the server side) with the…
user1126425
  • 2,385
  • 4
  • 18
  • 17
12
votes
2 answers

Why are some mysql connections selecting old data the mysql database after a delete + insert?

I'm having a problem with the sessions in my python/wsgi web app. There is a different, persistent mysqldb connection for each thread in each of 2 wsgi daemon processes. Sometimes, after deleting old sessions and creating a new one, some connections…
jmilloy
  • 7,875
  • 11
  • 53
  • 86
12
votes
3 answers

how do I specify extended ascii (i.e. range(256)) in the python magic encoding specifier line?

I'm using mako templates to generate specialized config files. Some of these files contain extended ASCII chars (>127), but mako chokes saying that the chars are out of range when I use: ## -*- coding: ascii -*- So I'm wondering if perhaps there's…
gred
  • 612
  • 1
  • 8
  • 15
12
votes
2 answers

Problem enabling Uvicorn auto-restart when launching programmatically with uvicorn.run

I'm attempting to get Uvicorn to automatically restart on detected file changes when launching programmatically, as it would when started from the command line with the --debug switch. The following statement is at the bottom of my api source code…
jpjenk
  • 459
  • 2
  • 8
  • 14