Reputation: 41
Well, first of all these are just a few tutorials I have followed:
projects.unbit.it/uwsgi/wiki/Doc
projects.unbit.it/uwsgi/wiki/Install
projects.unbit.it/uwsgi/wiki/RunOnNginx
projects.unbit.it/uwsgi/wiki/Quickstart
and realistically this one should have just worked, because it's baby steps.. right? http://library.linode.com/web-servers/nginx/python-uwsgi/debian-6-squeeze wrong... =[ Their uwsgi daemon "starter" doesn't work at all...
now, where I am at is I can get a simple hello world working if I am running a uwsgi from the command line, a quick example:
uwsgi -s 127.0.0.1:9001 --wsgi-file /home/www/test/application/wsgi_configuration_module.py
This is kind of desirable, kind of not.. Something I like is: it works, however it isn't a daemon so it's running like this: https://i.sstatic.net/oWyI4.jpg the problem there is: I can't do anything else, it requires me to manually start it, it can only run that one hello world script... where-as when I setup a quick nginx + php-fpm I can easily get it running on a socket such as /tmp/php.sock and I can easily get nginx sending php url's to that socket, so the php-fpm handles all my php needs...
What I would like to do:
get uwsgi auto starting on boot
get it working with nginx
get nginx to send python scripts through the uwsgi so it works correctly
get uwsgi with flask working? (after.. everything else)
can anyone help me with this? I'm decently savvy, it takes me a few times to figure something out well, and I have nginx down.. I have it down with php-fpm very well, but I haven't been able to get the python working at all... and I have multiple virtual machines for totally installing stuff wrong & needing to start over, so if someone wants to give it a go, be my guest.. thanks for any help/links/tips etc
Upvotes: 4
Views: 2938
Reputation: 2099
You could consider using http://supervisord.org/ to look after your process. As for serving your application, I'm only familiar with the arrangement where the WSGI server is invoked through Python. The Flask docs would have you use gevent like:
from gevent.wsgi import WSGIServer
from yourapplication import app
http_server = WSGIServer(('', 5000), app)
http_server.serve_forever()
If you don't have some particular reason to use uWSGI as an application server, I find this setup much easier. nginx just needs to act as a proxy. If uWSGI is a requirement, Flask docs have a section about nginx config, though I imagine you've already checked it out. If not: http://flask.pocoo.org/docs/deploying/uwsgi/#configuring-nginx
Upvotes: 2