Hi,
I try configure flask on nginx, but return the error "uWSGI Error wsgi
application not found" my vhost
server {
listen 80;
server_name flask.local;
location / {
try_files $uri @flasks;
}
location @flasks {
include uwsgi_params;
uwsgi_pass 127.0.0.1:9001;
}
access_log /Applications/MNPP/logs/nginx/flask.local.access.log;
error_log /Applications/MNPP/logs/nginx/flask.local.error.log;
}
and my app
from flask import Flask
app = Flask(__name__)
print "dentro"
@app.route('/')
def hello_world():
return "Hello World flask!"
if __name__ == '__main__':
app.run()
Any suggestions?
Thanks
--
SIN ETIQUETAS.[ PUNTO ]
http://flavors.me/jyr
http://pythoncocoa.com
http://opentumblr.com
Try something like this...
upstream flask {
server 127.0.0.1:9001;
}
server {
listen 80;
server_name _;
location / {
proxy_pass http://flask;
}
}
On Mon, Jul 4, 2011 at 7:09 PM, Jair Gaxiola <jyr.gaxiola@gmail.com> wrote:
> Hi,
>
> I try configure flask on nginx, but return the error "uWSGI Error wsgi
> application not found" my vhost
>
> server {
> listen 80;
> server_name flask.local;
>
> location / {
> try_files $uri @flasks;
> }
>
> location @flasks {
> include uwsgi_params;
> uwsgi_pass 127.0.0.1:9001;
> }
>
> access_log /Applications/MNPP/logs/nginx/flask.local.access.log;
> error_log /Applications/MNPP/logs/nginx/flask.local.error.log;
>
> }
>
> and my app
>
> from flask import Flask
> app = Flask(__name__)
> print "dentro"
> @app.route('/')
> def hello_world():
> return "Hello World flask!"
>
> if __name__ == '__main__':
> app.run()
>
>
> Any suggestions?
>
> Thanks
> --
> SIN ETIQUETAS.[ PUNTO ]
> http://flavors.me/jyr
> http://pythoncocoa.com
> http://opentumblr.com
>
--
Latest Blog: http://jamesthornton.com/blog/how-to-get-to-genius
> Hi, > > I try configure flask on nginx, but return the error "uWSGI Error wsgi > application not found" my vhost > > server { > listen 80; > server_name flask.local; > > location / { > try_files $uri @flasks; > } > > location @flasks { > include uwsgi_params; > uwsgi_pass 127.0.0.1:9001; > } > > access_log /Applications/MNPP/logs/nginx/flask.local.access.log; > error_log /Applications/MNPP/logs/nginx/flask.local.error.log; > > } > > and my app > > from flask import Flask > app = Flask(__name__) > print "dentro" > @app.route('/') > def hello_world(): > return "Hello World flask!" > > if __name__ == '__main__': > app.run() > > > Any suggestions? > > You should report uWSGI logs and command line/config file parameters. Your nginx configuration looks good, so you must have done some mistake in uWSGI config -- Roberto De Ioris http://unbit.it
On Tue, Jul 5, 2011 at 12:32 AM, Roberto De Ioris <roberto@unbit.it> wrote: > >> Hi, >> >> I try configure flask on nginx, but return the error "uWSGI Error wsgi >> application not found" my vhost >> >> server { >> listen 80; >> server_name flask.local; >> >> location / { >> try_files $uri @flasks; >> } >> >> location @flasks { >> include uwsgi_params; >> uwsgi_pass 127.0.0.1:9001; >> } >> >> access_log /Applications/MNPP/logs/nginx/flask.local.access.log; >> error_log /Applications/MNPP/logs/nginx/flask.local.error.log; >> >> } >> >> and my app >> >> from flask import Flask >> app = Flask(__name__) >> print "dentro" >> @app.route('/') >> def hello_world(): >> return "Hello World flask!" >> >> if __name__ == '__main__': >> app.run() >> >> >> Any suggestions? >> >> > > You should report uWSGI logs and command line/config file parameters. > > Your nginx configuration looks good, so you must have done some mistake in > uWSGI config Added two lines to my code: def application(environ, start_response): return app(environ, start_response) My complete code: https://gist.github.com/1064160 -- SIN ETIQUETAS.[ PUNTO ] http://flavors.me/jyr http://pythoncocoa.com http://opentumblr.com
> On Tue, Jul 5, 2011 at 12:32 AM, Roberto De Ioris <roberto@unbit.it> > wrote: >> >>> Hi, >>> >>> I try configure flask on nginx, but return the error "uWSGI Error wsgi >>> application not found" my vhost >>> >>> server { >>>   listen    80; >>>   server_name  flask.local; >>> >>>   location / { >>>    try_files $uri @flasks; >>>   } >>> >>>   location @flasks { >>>     include uwsgi_params; >>>     uwsgi_pass 127.0.0.1:9001; >>>    } >>> >>>   access_log >>>  /Applications/MNPP/logs/nginx/flask.local.access.log; >>>   error_log  /Applications/MNPP/logs/nginx/flask.local.error.log; >>> >>> } >>> >>> and my app >>> >>> from flask import Flask >>> app = Flask(__name__) >>> print "dentro" >>> @app.route('/') >>> def hello_world(): >>>   return "Hello World flask!" >>> >>> if __name__ == '__main__': >>>   app.run() >>> >>> >>> Any suggestions? >>> >>> >> >> You should report uWSGI logs and command line/config file parameters. >> >> Your nginx configuration looks good, so you must have done some mistake >> in >> uWSGI config > > Added two lines to my code: > > def application(environ, start_response): > return app(environ, start_response) > > My complete code: > > https://gist.github.com/1064160 Ugly :) You can do application = app in your code or force uWSGI to use "app" as the callable (instead of "application") with: --callable app or http://projects.unbit.it/uwsgi/wiki/Example#Flaskdeploy -- Roberto De Ioris http://unbit.it
On Tue, Jul 5, 2011 at 12:49 AM, Roberto De Ioris <roberto@unbit.it> wrote: > >> On Tue, Jul 5, 2011 at 12:32 AM, Roberto De Ioris <roberto@unbit.it> >> wrote: >>> >>>> Hi, >>>> >>>> I try configure flask on nginx, but return the error "uWSGI Error wsgi >>>> application not found" my vhost >>>> >>>> server { >>>>   listen    80; >>>>   server_name  flask.local; >>>> >>>>   location / { >>>>    try_files $uri @flasks; >>>>   } >>>> >>>>   location @flasks { >>>>     include uwsgi_params; >>>>     uwsgi_pass 127.0.0.1:9001; >>>>    } >>>> >>>>   access_log >>>>  /Applications/MNPP/logs/nginx/flask.local.access.log; >>>>   error_log  /Applications/MNPP/logs/nginx/flask.local.error.log; >>>> >>>> } >>>> >>>> and my app >>>> >>>> from flask import Flask >>>> app = Flask(__name__) >>>> print "dentro" >>>> @app.route('/') >>>> def hello_world(): >>>>   return "Hello World flask!" >>>> >>>> if __name__ == '__main__': >>>>   app.run() >>>> >>>> >>>> Any suggestions? >>>> >>>> >>> >>> You should report uWSGI logs and command line/config file parameters. >>> >>> Your nginx configuration looks good, so you must have done some mistake >>> in >>> uWSGI config >> >> Added two lines to my code: >> >> def application(environ, start_response): >> return app(environ, start_response) >> >> My complete code: >> >> https://gist.github.com/1064160 > > > Ugly :) > > You can do > > application = app > > in your code > > or force uWSGI to use "app" as the callable (instead of "application") with: > > --callable app > > or > > http://projects.unbit.it/uwsgi/wiki/Example#Flaskdeploy > Ok, my plist file in https://gist.github.com/1064322 Thanks -- SIN ETIQUETAS.[ PUNTO ] http://flavors.me/jyr http://pythoncocoa.com http://opentumblr.com
> On Tue, Jul 5, 2011 at 12:49 AM, Roberto De Ioris <roberto@unbit.it> > wrote: >> >>> On Tue, Jul 5, 2011 at 12:32 AM, Roberto De Ioris <roberto@unbit.it> >>> wrote: >>>> >>>>> Hi, >>>>> >>>>> I try configure flask on nginx, but return the error "uWSGI Error >>>>> wsgi >>>>> application not found" my vhost >>>>> >>>>> server { >>>>> ÃÂ ÃÂ listen ÃÂ ÃÂ ÃÂ 80; >>>>> ÃÂ ÃÂ server_name ÃÂ flask.local; >>>>> >>>>> ÃÂ ÃÂ location / { >>>>> ÃÂ ÃÂ ÃÂ try_files $uri @flasks; >>>>> ÃÂ ÃÂ } >>>>> >>>>> ÃÂ ÃÂ location @flasks { >>>>> ÃÂ ÃÂ ÃÂ ÃÂ include uwsgi_params; >>>>> ÃÂ ÃÂ ÃÂ ÃÂ uwsgi_pass 127.0.0.1:9001; >>>>> ÃÂ ÃÂ ÃÂ } >>>>> >>>>> ÃÂ ÃÂ access_log >>>>> ÃÂ /Applications/MNPP/logs/nginx/flask.local.access.log; >>>>> ÃÂ ÃÂ error_log >>>>> ÃÂ /Applications/MNPP/logs/nginx/flask.local.error.log; >>>>> >>>>> } >>>>> >>>>> and my app >>>>> >>>>> from flask import Flask >>>>> app = Flask(__name__) >>>>> print "dentro" >>>>> @app.route('/') >>>>> def hello_world(): >>>>> ÃÂ ÃÂ return "Hello World flask!" >>>>> >>>>> if __name__ == '__main__': >>>>> ÃÂ ÃÂ app.run() >>>>> >>>>> >>>>> Any suggestions? >>>>> >>>>> >>>> >>>> You should report uWSGI logs and command line/config file parameters. >>>> >>>> Your nginx configuration looks good, so you must have done some >>>> mistake >>>> in >>>> uWSGI config >>> >>> Added two lines to my code: >>> >>> def application(environ, start_response): >>> Â return app(environ, start_response) >>> >>> My complete code: >>> >>> https://gist.github.com/1064160 >> >> >> Ugly :) >> >> You can do >> >> application = app >> >> in your code >> >> or force uWSGI to use "app" as the callable (instead of "application") >> with: >> >> --callable app >> >> or >> >> http://projects.unbit.it/uwsgi/wiki/Example#Flaskdeploy >> > > Ok, my plist file in https://gist.github.com/1064322 > > Thanks > > This options are not needed for your setup: <string>--vhost</string> <string>--no-site</string> <string>--pythonpath</string> <string>/Applications/MNPP/Library/python26/lib/python2.6/lib-dynload/</string> <string>--pythonpath</string> <string>/Applications/MNPP/Library/python26/lib/python2.6/site-packages/</string> and change <string>--callable</string> <string>app</string> to <string>--module</string> <string>myapp:app</string> where myapp is the name of your flask app (without .py extension) in the /Applications/MNPP/htdocs/ directory -- Roberto De Ioris http://unbit.it