python - Flask deployement on lighttpd and raspberry pi -


i'm trying deploy hello flask app raspberry pi using lighttpd fastcgi.

i followed instructions on http://flask.pocoo.org/docs/0.10/deploying/fastcgi/ best of ability

here flask app (/var/www/demoapp/hello.py)

from flask import flask app = flask(__name__)  @app.route("/") def hello():     return "hello world flask yeh!"  if __name__ == "__main__":     app.run(host='0.0.0.0', port=5000) 

and here .fcgi file (/var/www/demoapp/hello.fcgi)

#!/usr/bin/python flup.server.fcgi import wsgiserver yourapplication import app  if __name__ == '__main__':     wsgiserver(app).run() 

and here added /etc/lighttpd/lighttpd.conf

fastcgi.server = ("/hello.fcgi" =>     ((         "socket" => "/tmp/hello-fcgi.sock",         "bin-path" => "/var/www/demoapp/hello.fcgi",         "check-local" => "disable",         "max-procs" => 1     )) )  alias.url = (     "/static/" => "/var/www/demoapp/static/", ) 

i 404 not found error

by way /tmp/hello-fcgi.sock file

please help. i'm trying find simple way deploy flask on raspberry pi web server. have tried several methods. fastcgi seemed easiest. if there easier way let me know please.

thank you

vincent

i believe problem in hello.fcgi file, importing module named yourapplication, however, flask application created named hello.

try changing line:

from yourapplication import app from hello import app

edit: - double check url when testing - since @app.route set root, must include trailing slash in url, eg:

http://xxx.xxx.x.xx/hello.fcgi/

and not

http://xxx.xxx.x.xx/hello.fcgi


Comments