I want use nginx, uWsgi, Flask on centos 5, but always has some error.
3 app are all newest version, the uwgsi_params file copy from uwsgi/nginx.
I use virtualenv to config python env.
project path: /path/to/project
virtualevn: /path/to/virenv/pyenv27
First step:
I use nginx and uWsgi, and browse show error page:
uWSGI Error
wsgi application not found
Nginx config:
location / {
uwsgi_pass 127.0.0.1:5555;
uwsgi_param UWSGI_PYHOME /path/to/virenv/pyenv27;
uwsgi_param UWSGI_CHDIR /path/to/project;
uwsgi_param UWSGI_SCRIPT uwsgi;
uwsgi_param SCRIPT_NAME "";
include uwsgi_params;
}
Flask file is simple:
import sys
sys.path.append(sys.path[0])
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return "Hello World!"
#app.config.from_pyfile('product.cfg')
def application(environ, start_response):
return app(environ, start_response)
if __name__ == '__main__':
app.run()
uWsgi command:
/opt/uwsgi -s 127.0.0.1:5555 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pidfile /var/run/uwsgi.pid --no-site --vhost --limit-as 256
2 Step
I use uWsgi only.
cmd:
/opt/uwsgi/uwsgi --xml /path/to/project/uwsgi.xml
but I got error:
ImportError: No module named site
uWsgi xml:
<uwsgi>
<chdir>/path/to/project/</chdir>
<pythonpath>/path/to/project</pythonpath>
<virtualenv>/path/to/virenv/pyenv27</virtualenv>
<wsgi-file>/path/to/project/uwsgi.py</wsgi-file>
<callable>app</callable>
<socket>:6000</socket>
<chmod-socket>666</chmod-socket>
<master />
<processes>1</processes>
<uid>uwsgi</uid>
<gid>uwsgi</gid>
<disable-logging>false</disable-logging><!-- Errors are still logged; this just disables request logging which Cherokee takes care of -->
<daemonize>/path/to/project/uwsgi.log</daemonize>
<vacuum />
<no-orphans />
</uwsgi>
Is there something wrong here?