pylons由一堆积木堆砌而成


pylons是一堆积木堆砌而成

基本可以拆开了用

比如paster的serve可以用到Quixote中,当文件修改时自动重启
步骤是:
1.qxdemo.egg-info
entry_points.txt
[paste.server_runner]
medusa=qxdemo.scripts.server:run_server

[paste.app_factory]
main = qxdemo.scripts.server:make_app

2.server.py
from qxdemo.config.environment import load_environment

def make_app(global_conf, full_stack=True, **app_conf):
    from quixote.publish import Publisher
    load_environment(global_conf,app_conf)
    publisher = Publisher('qxdemo.urls')
    return publisher

def run_server(wsgi_app, global_conf, host='localhost',port=8080):
    from medusa import http_server, xmlrpc_handler
    from quixote.server import medusa_http
    server = http_server.http_server(host,int(port))
   
    dh = medusa_http.QuixoteHandler(wsgi_app, 'qxdemo/links server', server)
   
    server.install_handler(dh)
   
    import asyncore
    asyncore.loop()


比如webhelpers的分页类

比如mako模板

比如sqlalchemy

等等

而pylons本身,不过是一个约定罢了



你可能感兴趣的:(Pylons)