我使用: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/
如下:
打算使用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.