L
Littlefield, Tyler
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.
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.