- Info
See github for the latest source.
- Author
W-Mark Kubacki <wmark@hurrikane.de>
- Supports non-regex handlers, which are plain strings in a dictionary. Greatly reduces the overhead for requests.
- Localization is based upon the standard Gettext instead of the CSV implementation in the original Tornado. Moreover, it supports pluralization exactly like Tornado does. By Alexandre Fiori.
- Templating is done by Mako, which features everything the original templating module could (including compiling into native Python modules) and which has mature error reporting functions.
- Validation by FormEncode with decorators similar to TurboGears'.
- If
dev-python/murmur
is installed, static files will be hashed by Murmurhash2 and not SHA1 or MD5. - Sessions support from Milan Cermak. You can store session data in files, MySQL, Redis, Memcached and MongoDB.
- Has Location and Path decorators, courtesy of Jeremy Kelley, Peter Bengtsson et al.
- Supports the way faster ultrajson (aka ujson) and python-cjson (aka cjson).
ujson
is faster and thus preferred overcjson
.
import anzu.httpserver
import anzu.ioloop
import anzu.web
@anzu.web.location('/')
class MainHandler(anzu.web.RequestHandler):
def get(self):
self.write("Hello, world")
@anzu.web.path(r'/(\w+)')
class SecondHandler(anzu.web.RequestHandler):
def get(self, name):
self.write("Hello, %s" % name)
if __name__ == "__main__":
application = anzu.web.Application()
http_server = anzu.httpserver.HTTPServer(application)
http_server.listen(8888)
anzu.ioloop.IOLoop.instance().start()
`Location`s are being looked up first.
Please see the demos folder for more examples.
Like Tornado Anzu is licensed under the Apache Licence, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0.html).
To install:
python setup.py build
sudo python setup.py install
Anzu has been tested on Python 2.6 and 2.7. To use all of the features of Anzu, you need to have PycURL and a JSON library like simplejson installed.
On Mac OS X, you can install the packages with:
sudo easy_install setuptools pycurl==7.16.2.1 simplejson
On Ubuntu Linux, you can install the packages with:
sudo apt-get install python-pycurl python-simplejson
On Gentoo, you will need the OSSDL overlay prior installing with:
sudo emerge dev-python/anzu