serve.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:singing_horse 作者: f0k 项目源码 文件源码
def main():
    if len(sys.argv) > 1:
        print "Serves the demo. Needs bottle.py to run. Will serve via bjoern"
        print "if installed, otherwise via wsgi_ref. Reads its configuration "
        print "from config.ini."
        return

    # load configuration
    port = int(CONFIG.get('port', 9090))
    staticdir = os.path.join(os.path.dirname(__file__), 'static')

    # start web server
    print "Starting web server on localhost:%d..." % port
    app.route('/static/:path#.+#', callback=lambda path:
            bottle.static_file(path, root=staticdir))
    try:
        import bjoern
    except ImportError:
        bjoern = None
    bottle.run(app, host='localhost', port=port,
            server='bjoern' if bjoern else 'wsgiref')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号