Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #29515

using uwsgi to get flask going

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <tyler@tysdomain.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'root': 0.04; 'deny': 0.07; 'exit': 0.07; 'pypy': 0.07; 'skip:/ 10': 0.07; 'python': 0.09; '###': 0.09; 'script,': 0.09; 'spawn': 0.09; 'subject:using': 0.09; 'index': 0.13; '"$1"': 0.16; 'chdir': 0.16; 'chmod': 0.16; 'chown': 0.16; 'echo': 0.16; 'esac': 0.16; 'example?': 0.16; 'from:addr:tyler': 0.16; 'from:addr:tysdomain.com': 0.16; 'from:name:littlefield, tyler': 0.16; 'index.html': 0.16; 'message-id:@tysdomain.com': 0.16; 'nginx,': 0.16; 'received:69.164': 0.16; 'received:69.164.206': 0.16; 'received:69.164.206.65': 0.16; 'received:tds-solutions.net': 0.16; 'stop)': 0.16; 'skip:u 30': 0.17; 'app': 0.19; 'skip:p 30': 0.20; 'trying': 0.21; 'all:': 0.22; 'init': 0.22; 'received:192.168.1.100': 0.22; 'runs': 0.22; 'script': 0.24; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'appreciated.': 0.26; 'skip:# 10': 0.27; "doesn't": 0.28; 'project:': 0.29; 'url:code': 0.29; "i'm": 0.29; 'skip:- 10': 0.32; 'info': 0.32; 'getting': 0.33; 'skip:s 30': 0.33; 'int': 0.33; 'like:': 0.33; 'handle': 0.33; 'anyone': 0.33; 'to:addr:python-list': 0.33; 'skip:d 20': 0.34; 'server': 0.35; 'anything': 0.36; 'skip:l 20': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'application': 0.40; 'received:192.168': 0.40; 'end': 0.40; 'easy': 0.60; 'first': 0.61; 'kind': 0.61; 'url:p': 0.63; 'touch': 0.69; 'subject:get': 0.81; 'all;': 0.84; 'light-weight': 0.84; 'understand,': 0.84; 'care,': 0.91
X-Spam-Checker-Version SpamAssassin 3.3.1 (2010-03-16) on wuff
X-Spam-Level
X-Spam-Status No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=unavailable version=3.3.1
Date Wed, 19 Sep 2012 12:14:00 -0600
From "Littlefield, Tyler" <tyler@tysdomain.com>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
MIME-Version 1.0
To python-list@python.org
Subject using uwsgi to get flask going
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.934.1348079057.27098.python-list@python.org> (permalink)
Lines 82
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1348079057 news.xs4all.nl 6904 [2001:888:2000:d::a6]:47970
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:29515

Show key headers only | View raw


Hello all:
This is my first shot with UWSGI and Python on Nginx, and I'm getting 
kind of confused.
My uwsgi init script looks like:
#!/bin/sh
#/etc/init.d/uwsgi
### BEGIN INIT INFO
# Provides: uwsgi
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
PID="/var/run/uwsgi/uwsgi.pid"
SOCKET="/var/run/uwsgi/uwsgi.sock"
DAEMON="/usr/local/bin/uwsgi"
LOGFILE="/var/log/uwsgi.log"
ARGS="--master --socket $SOCKET -d --workers 4 --pidfile $PID --vacuum 
--max-requests 400 --gid uwsgi --uid uwsgi --logto2 $LOGFILE --chdir2 
/opt/nginx/html/falcon -w app:app"
case "$1" in
start)
echo "Starting uwsgi"
touch $SOCKET
touch $LOGFILE
chown uwsgi:uwsgi $LOGFILE
chmod 660 $LOGFILE
chown -R www-data:uwsgi $SOCKET
chmod 660 $SOCKET
start-stop-daemon -p $PID --start --exec $DAEMON -- $ARGS
;;
stop)
echo "Stopping uwsgi."
start-stop-daemon --signal INT -p $PID --stop $DAEMON -- $ARGS
;;
restart)
echo "Stopping uwsgi."
start-stop-daemon --signal INT -p $PID --stop $DAEMON -- $ARGS
echo "Starting uwsgi"
start-stop-daemon -p $PID --start --exec $DAEMON -- $ARGS
;;
*)
echo "Usage: /etc/init.d/uwsgi stop|stop|restart."
exit 1
;;
esac
I'm trying to chdir so I can use app:app (ap.py is the script, app is 
the application in app.py). From what I understand, uwsgi just spawns a 
Python process and runs app.py to handle requests? It doesn't spawn a 
process per instance? How easy would it be to force it to use PyPy for 
example?
Also my nginx config:
     server {
server_name www.dev.tds-solutions.net dev.tds-solutions.net;
         listen       80;
access_log  logs/dev.access.log;

         location / {
             root   html/falcon;
             index  index.html index.htm;
try_files $uri @uwsgi;
         }

location ~ /\.ht {
    deny  all;
}

location @uwsgi {
include /opt/nginx/conf/uwsgi_params;
uwsgi_pass unix:/var/run/uwsgi/uwsgi.sock;
     }
}
anyone see anything wrong? Any info would be greatly appreciated.

-- 
Take care,
Ty
http://tds-solutions.net
The aspen project: a barebones light-weight mud engine:
http://code.google.com/p/aspenmud
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

using uwsgi to get flask going "Littlefield, Tyler" <tyler@tysdomain.com> - 2012-09-19 12:14 -0600

csiph-web