免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5405 | 回复: 5
打印 上一主题 下一主题

flask 的部署问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-06-09 17:12 |只看该作者 |倒序浏览
本帖最后由 ccz2005 于 2010-06-10 13:01 编辑

看了flask,根据它的文档 进行部署,用lighttpd,fcgi,不成功, 有哪位高手帮帮忙,
官方文档十分简略:
Creating a .fcgi file
First you need to create the FastCGI server file. Let’s call it yourapplication.fcgi:

  1. #!/usr/bin/python
  2. from flup.server.fcgi import WSGIServer
  3. from yourapplication import app
  4. WSGIServer(app).run()
复制代码
This is enough for Apache to work, however lighttpd and nginx need a socket to communicate with the FastCGI server. For that to work you need to pass the path to the socket to the WSGIServer:

WSGIServer(application, bindAddress='/path/to/fcgi.sock').run()
The path has to be the exact same path you define in the server config.

Save the yourapplication.fcgi file somewhere you will find it again. It makes sense to have that in /var/www/yourapplication or something similar.

Make sure to set the executable bit on that file so that the servers can execute it:

# chmod +x /var/www/yourapplication/yourapplication.fcgi
Configuring lighttpd
A basic FastCGI configuration for lighttpd looks like that:
  1. fastcgi.server = ("/yourapplication" =>
  2.     "yourapplication" => (
  3.         "socket" => "/tmp/yourapplication-fcgi.sock",
  4.         "bin-path" => "/var/www/yourapplication/yourapplication.fcgi",
  5.         "check-local" => "disable"
  6.     )
  7. )
复制代码
This configuration binds the application to /yourapplication. If you want the application to work in the URL root you have to work around a lighttpd bug with the LighttpdCGIRootFix middleware.

Make sure to apply it only if you are mounting the application the URL root.


上面的lighttpd的配置是有错误的,我在lighttpd上部署不成功

论坛徽章:
0
2 [报告]
发表于 2010-06-09 23:55 |只看该作者
虽然不懂这个,不过你最好还是说明具体的部署环境与过程,以及结果,以便他人分析。

论坛徽章:
0
3 [报告]
发表于 2010-06-10 10:46 |只看该作者
回复 2# jjj137


    对,最好把遇见的问题也罗列一下

论坛徽章:
0
4 [报告]
发表于 2010-06-10 19:47 |只看该作者
flup 安装了没?

论坛徽章:
0
5 [报告]
发表于 2010-06-10 23:12 |只看该作者
flup已经安装

论坛徽章:
0
6 [报告]
发表于 2010-06-29 15:50 |只看该作者
flask 走fastcgi我已经部署成功了 但是nginx的path_info 导致 url routing有bug
详情看这里 http://www.yyliuliang.cn/posts/f ... st-cgi-incompleted/
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP