`
canofy
  • 浏览: 820444 次
  • 性别: Icon_minigender_1
  • 来自: 北京、四川
社区版块
存档分类
最新评论

flup安装问题

阅读更多
   在windows下flup一直安装不上,不知道为什么,在linux下面安装一次就成功了~~
同样的安装方式,网上搜索了半天,都是一笔带过,都没有说怎么在Windows下具体的安装方式,找到一个也碰到我这样的问题的帖子,但没有解决办法,很郁闷耶~~~
   安装方式如下(python版本为2.5):
   从网站上下载flup-1.0.1.tar.gz版本,解压缩至c盘,然后进入到解压缩的目录,在dos下执行python setup.py install 命令,执行完后在python环境下输入import flup.server.fcgi_fort ,报错,具体错误如下:
>>> import flup.server.fcgi_fort
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named fcgi_fort

执行from flup.server.fcgi_fork import WSGIServer,也报错,错误信息如下:
>>> from flup.server.fcgi_fork import WSGIServer
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "build\bdist.win32\egg\flup\server\fcgi_fork.py", line 56, in <module>
  File "build\bdist.win32\egg\flup\server\preforkserver.py", line 53, in <module
>
ImportError: Requires eunuchs module for Python < 2.4

没有看懂这些信息,下班后回去再试一下~~~

难道是传说中的操作系统因素,公司的电脑是win2003的~~

回去后用xp试试~~~

试了一试,好像是版本不一致,在windows xp下安装,也报上面的错误,
后来又试了一下其它的文件,如:import flup.server.scgi,import flup.server.fcgi_base都是正确的~~~
现在还不清楚为啥装不上~~~
继续查原因~~~

由import flup.server.fcgi_fork这个产生的错误信息进入到preforkserver.py文件

确认了是from flup.server.preforkserver import PreforkServer这句出错

再通过import flup.server.preforkserver这个产生的信息知道了是import eunuchs.socketpair这句抛出了异常,异常信息如下:
raise ImportError, 'Requires eunuchs module for Python < 2.4',好像是需要eunuchs相应的东东,

eunuchs从网上下载下来了,但里面的文件又是以.so结尾的文件,
需要用到ctypes 模块(需要去google上搜),它提供跨平台的动链接库的直接调用。windows下是dll,*nix下是.so或.sl吧。
哎~~~~这个貌似又是linux下的东东,都不知道该怎么弄了~~~

http://code.djangoproject.com/ticket/8742这篇文章上写了一些相关的信息,如下:
Django FastCGI cannot be used on Windows, and possibly other non-Unix environments.

Currently the FastCGI feature of Django (manage.py runfcgi) relies on the Python library 'flup', which relies on Unix-only socket functions (socket.socketpair(), socket.fromfd(), etc.) making it impossible to use the FastCGI feature of Django on non-Unix envs like Windows, and hence, making it impossible to serve Django with non-Apache (non-mod_python) httpds like lighttpd on non-Unix envs.

Possible solutions: The function socketpair() is unofficially implemented on Windows by a recipe. (http://code.activestate.com/recipes/525487/) Committing this patch to the flup project is not a hard work. However, the function fromfd() has nothing like that. There is a patch enabling its Windows use (http://bugs.python.org/issue1378) but the patch is not yet applied on the Windows release, even on Python 2.6b2. Rewriting the FastCGI feature with python-fastcgi (http://pypi.python.org/pypi/python-fastcgi) could be a more work than flup, but then the feature can support Windows.

Unix environments, especially GNU/Linux, is of course better than Windows to be used as a web server, but there are some situations where Windows and FastCGI have to be used. It would be good to have Django FastCGI available on Windows.


进入到http://code.activestate.com/recipes/525487/这个网址,把上面的代码复制到preforkserver.py中,把下面的代码删掉:
try:
        import eunuchs.socketpair
    except ImportError:
        # TODO: Other alternatives? Perhaps using os.pipe()?
        raise ImportError, 'Requires eunuchs module for Python < 2.4'
把def socketpair()方法下的 s1, s2 = eunuchs.socketpair.socketpair()修改为s1, s2 = SocketPair,之后在python环境中输入import flup.server.fcgi_fork,就没有出错了

这样终于没有报错了,但新的问题又出现了~~
执行下面的语句:
python manage.py runfcgi method=threaded host=127.0.0.1 port=8050 daemonize=false
在浏览器中输入http://127.0.0.1:8050/,貌似一直在请求,但得不到结果,不知道是什么原因,什么提示也没有
ps:在更改flup的东西以前执行上面的语句和之后得到的结果一致(极有可能是修改有误,不知道别人是怎么在Windows下安装flup的,新手的困惑啊)~~~
哎~~~~~~~~~~~~~~~~~~~~~
怀疑最初的想法是否正确~~~





附件为flup-1.0.1.tar.gz
分享到:
评论
3 楼 ruijf 2011-02-17  
flup.server.fcgi_fort
这个是flup在linux下运行的一种方式,windows是没有的
2 楼 xie_en 2009-10-23  
python 用的我有一种想死的冲动……
1 楼 linvar 2009-06-22  
我刚遇到同样问题, 按LZ的做法确实能runfcgi.
LZ最后那个问题是因为runfcgi是 fastCGI 协议,
你需要web server用fastCGI协议去访问,
比如 apache, httpttd, nginx 这些web server.
不过我使用nginx windows版本并不能够使用 fastCGI,
应该是操作系统实现问题,
不知道其他两个能不能实现

相关推荐

    Python库 | flup-1.0.3.dev_20110111-py2.7.egg

    资源分类:Python库 所属语言:Python 资源全名:flup-1.0.3.dev_20110111-py2.7.egg 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    distribute-0.7.3,flup3-master

    python3下运行django1,6不能运行提示需要安装flup,但是flup1.02不能安装在python3下的,需要安装flup3-master,安装flup3-master需要先安装distribute-0.7.3

    Windows系统下使用flup搭建Nginx和Python环境的方法

    首先确保你的电脑里已经安装了Python和Django,接下来我们还需要两个组件,nginx服务器和flup(Python的FastCGI组件) nginx下载地址:http://nginx.org/en/download.html flup下载地址:...

    Flup页面「Page Flup」-crx插件

    用鼠标翻页 这个小扩展可以让你节省宝贵的时间。只需安装它,打开您最喜爱的网站,将鼠标移动到左侧,直到停止并点击 - 页面将被抬起。 支持语言:English,русский

    Page Flup-crx插件

    语言:English,русский 用鼠标向上翻页 这个小扩展名可以节省您的宝贵时间。 只需安装它,打开您喜欢的网站,向左移动鼠标直至停止,然后单击-页面将被抬起。

    在Windows系统上搭建Nginx+Python+MySQL环境的教程

    2 安装flup 下载对应版本的flup,这里下载flup3.x版本,适合python3.2,下载地址:https://github.com/chxanders/flup3 解压(比如解压到D:\flup) 安装(进入到python的安装路径,然后执行下面的命令 &gt;pyt

    flupy:python和shell的流利数据管道

    用pip安装flupy: $ pip install flupy 图书馆 from itertools import count from flupy import flu # Processing an infinite sequence in constant memory pipeline = ( flu ( count ()) . map ( lambda x : x...

    berrystats:FlaskJinja2 Web 应用程序报告有关 Raspberry Pi 的各种统计信息

    需要:Nginx、Python 2、Flask、Jinja 2、Flup 和大约 10MB 的 RAM 截图 主页选项卡:: 系统选项卡: 关于选项卡: 安装 安装依赖: 拱: $ sudo pacman -S git nginx python2 python2-distribute $ sudo easy_...

    ubuntu lighttpd+webpy (fastcgi)配置方法

    首先安装 lighttpd 和 webpy,因为用 kpackagekit 做软件管理,在安装 webpy 的时候会自动安装 flup

    aop:自动化运维平台(代码发布&&任务发布)

    flup paramiko django-excel-response MySQL-python ##主要功能 服务器的资源统计 svn的在线发布 脚本的批量执行 ##安装部署 修改aopproject/settings.py 设置数据库类型,账号密码 运行python manage.py syncdb ...

Global site tag (gtag.js) - Google Analytics