Not exactly. I have two instances of uwsgi, one hosts web apps, and
other is used as logging server.
First I run with following command and configuration files:
command:
/home/www/src/uwsgi/uwsgi --ini /home/www/uwsgi.conf
uwsgi.conf:
[uwsgi]
emperor = /home/www/uconfigs
master = true
die-on-term = true
enable-threads = true
daemonize = /home/www/logs/uwsgi.log
config of one of the applications (uatrains.ini):
[uwsgi]
chdir = /home/www
socket = /home/www/sockets/uatrains.socket
wsgi = uatrains
ini = /home/www/uconfigs/common.conf
common.conf:
[uwsgi]
callable = app
enable-threads = true
req-logger = socket:127.0.0.1:18109
Second instance I have tried to run in three ways:
* executing command '/home/www/src/uwsgi/uwsgi --udp 127.0.0.1:18109',
in this case everything works fine, I have request log entries
written to stdout.
* executing with command '/home/www/src/uwsgi/uwsgi --udp
127.0.0.1:18109 --wsgi-file udptest.py --callable app', where
content of udptest.py file is:
import smtplib
from email.mime.text import MIMEText
def app(env, start_res):
start_res('200 OK', [('Content-Type', 'text/html')])
sender = '[email protected] (www)'
recipient = '[email protected]'
if 'headers' not in data:
data['headers'] = ''
text = 'Yo!!!'
msg = MIMEText(text)
msg['Subject'] = data['subject']
msg['From'] = sender
msg['To'] = recipient
s = smtplib.SMTP('localhost')
s.sendmail(sender, recipient, msg.as_string())
s.quit()
return bytes('', 'utf-8')
in this case I also have request log entries written to stdout, but
wsgi app isn't executing.
* executing with command '/home/www/src/uwsgi/uwsgi --udp
127.0.0.1:18109 --ini cgi.conf', where cgi.conf is:
[uwsgi]
plugins = cgi
cgi = /=/home/www/cgi
cgi-allowed-ext = .py
cgi-helper = .py=python
cgi-index = index.py
and aindex.py is:
import smtplib
from email.mime.text import MIMEText
start_res('200 OK', [('Content-Type', 'text/html')])
sender = '[email protected] (www)'
recipient = '[email protected]'
text = 'Yo!!!'
msg = MIMEText(text)
msg['Subject'] = data['subject']
msg['From'] = sender
msg['To'] = recipient
s = smtplib.SMTP('localhost')
s.sendmail(sender, recipient, msg.as_string())
s.quit()
in this case I also, as before, have request log entries written to
stdout, but, this time, cgi app isn't executing.
Under not executing wsgi and cgi apps I mean that I haven't receive test
emails.
On 03/27/2013 06:32 PM, Roberto De Ioris wrote:
Is it possible to run wsgi or cgi python script inside uwsgi which
started as udp log server in order to process received log entries?
Thanks.
You mean adding --udp to an uWSGI instance running a web application ?
If it is what you mean, yes there are no problems in it (for example it is
a common setup for multicast logging where all of the nodes in a cluster
receive a copy of the logline)
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi