在eclipse上设置Quixote开发环境

本文详细介绍如何在Eclipse环境中使用Python2.4.2及Quixote2.5搭建基于simple_server的Web应用开发环境,并通过修改源码实现自定义应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

我使用:eclipse 3.2,Python 2.4.2 ,Quixote 2.5,pydev 1.3.14
打算使用Quixote自带的simple_server进行开发,免得捣鼓apache怪麻烦的

前面学习时,自己设定了一个PYTHONPATH,将maqi目录加入,现在把它从Windows环境变量中删掉。

1.首先建立一个PYDev工程,名字为MyQuixote.,(eclipse 的workspace为F:/workspace )
2.建立一个sourcefolder,命名为src
3.导入quixote2.5/quixote目录(eclipse将其拷贝到F:/workspace/myQuixote下)到刚才建立的src下
4.将导入的quixote重命名为maqi.maqi就是我的appname
5.修改server/simple_server.py 106行如下:
    if __name__ == '__main__':
    #from quixote.server.util import get_server_parser
   #指向maqi app所在包
    from maqi.server.util import get_server_parser

6.修改server/util.py 19行
     #指向maqi包,我的APP :)
    #default_factory = 'quixote.demo.create_publisher'
    default_factory = 'maqi.demo.create_publisher'

7.修改demo/root. ptl 23行
将hello world!修改为
<h1>Hello, maqi!</h1>

8.修改demo.__init__.py
def create_publisher():
#    from quixote.demo.root import RootDirectory
    from maqi.demo.root import RootDirectory
    return Publisher(RootDirectory(), display_exceptions='plain')

9.运行simple_server.py
10.访问:http://localhost:8080/
如下:

Hello, maqi!

To understand what's going on here, be sure to read the doc/demo.txt file included with Quixote.

Here are some features of this demo:

  • simple: A Python function that generates a very simple document.
  • plain: A Python function that generates a plain text document.
  • error: A Python function that raises an exception.
  • publish_error: A Python function that raises a PublishError exception. This exception will be caught by a _q_exception_handler method.
  • dumpreq: Print out the contents of the HTTPRequest object.
  • css: The stylesheet for this document.
  • extras/: Demos of some of Quixote's more advanced features.
root.ptl修改结果已经显示在界面
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值