Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > using uwsgi to get flask going

Reply
Thread Tools

using uwsgi to get flask going

 
 
Littlefield, Tyler
Guest
Posts: n/a
 
      09-19-2012
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: problem to install Flask MRAB Python 2 01-06-2012 08:01 AM
db agnostic admin for Flask? est Python 1 12-30-2011 01:04 AM
Firefighters at the site of WTC7 "Move away the building is going to blow up, get back the building is going to blow up." Midex Python 24 05-07-2007 04:23 AM
flask like program for Mandrake? or Drip problem. cowboyzlinux NZ Computing 4 07-18-2003 09:05 AM
VPN going up but traffic going one way PLP Cisco 1 07-11-2003 08:28 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57