gunicorn

Flask Gunicorn app can't get __name__ to equal '__main__'

孤街浪徒 提交于 2019-11-26 11:35:01
问题 I have this from /home/myname/myapp/app.py : from flask import Flask app = Flask(__name__) print __name__ @app.route(\'/\') def index(): return \"Hello world!\" if __name__ == \'__main__\': print \'in if\' app.run() When I run: $ gunicorn app:app -b 127.0.0.2:8000 It says: 2013-03-01 11:26:56 [21907] [INFO] Starting gunicorn 0.17.2 2013-03-01 11:26:56 [21907] [INFO] Listening at: http://127.0.0.2:8000 (21907) 2013-03-01 11:26:56 [21907] [INFO] Using worker: sync 2013-03-01 11:26:56 [21912]

gunicorn autoreload on source change

孤者浪人 提交于 2019-11-26 10:28:46
问题 Finally I migrated my development env from runserver to gunicorn/nginx. It\'d be convenient to replicate the autoreload feature of runserver to gunicorn, so the server automatically restarts when source changes. Otherwise I have to restart the server manually with kill -HUP . Any way to avoid the manual restart? 回答1: While this is old question, just for consistency - since version 19.0 gunicorn has --reload option. So no third party tools needed more. 回答2: One option would be to use the --max

(13: Permission denied) while connecting to upstream:[nginx]

▼魔方 西西 提交于 2019-11-26 09:10:48
I am working with configuring django project with nginx and gunicorn. While I am accessing my port gunicorn mysite.wsgi:application --bind=127.0.0.1:8001 in nginx server I am getting the following error in my error log file. 2014/05/30 11:59:42 [crit] 4075#0: *6 connect() to 127.0.0.1:8001 failed (13: Permission denied) while connecting to upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8001/", host: "localhost:8080" My nginx.conf file server { listen 8080; server_name localhost; access_log /var/log/nginx/example.log; error_log /var/log

How many concurrent requests does a single Flask process receive?

六月ゝ 毕业季﹏ 提交于 2019-11-26 09:05:42
问题 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 handle 4 concurrent requests? I do mean concurrent requests, and not requests per second or anything else. 回答1: When running the development server you get running app.run() , you get a single synchronous process, which means at most 1 requests being processed at a time. By sticking Gunicorn