Welcome to Jolla


Jolla is a simple and fast API server written in Python 2.7.

Jolla is based on gevent's pywsgi. because gevent is based on a high performance lib , libev, which is written in C language.

here is what gevent got(from gevent documentation):

and all above is included in Jolla.

Jolla also got something special:

When I wrote Jolla,what I want to do is a high performance API server for you to simply obey its short rule,and get your calculation result fast be sent to browser or mobile for your service.so I made Jolla as simple as possible.

Hope you guys like it.

DOCUMENTATION


the Tutorial and documentation is 中文版 English Edition

INSTALL


pip install Jolla

or

git clone https://github.com/salamer/jolla
cd jolla
python setup.py install

QUICKSTART


Create a app.py,and write dowm:

from jolla import server,SessionError,plugins,session,HTTP404Error

session = session()


def index(request):
    return plugins.render('index.html')

def chinese(request):
    res={}
    res['ww']='海贼王'
    return plugins.render_json(res)


def blog(request):
    if request['method'] == 'GET':
        return plugins.render_json({'name': session.get_value('name')})
    else:
        if request['method'] == 'POST':
            session.add_value('name', request['name'])
            return 'ok'


class app(server.WebApp):
    urls = [
        (r'/', index),
        (r'/blog/<name>', blog),
        (r'/chinese',chinese)
    ]

if __name__ == '__main__':
    server = server.jolla_server(app)
    server.run_server()

and then,run:

python app.py

Then open the http://127.0.0.1:8000 on your browser.

LICENSE

Copyright © 2016 by Aljun

Under Apache license : http://www.apache.org/licenses/