Morepath: Super Powered Python Web Framework

Morepath is a Python web microframework, with super powers.

Morepath is an Python WSGI microframework. It uses routing, but the routing is to models. Morepath is model-driven and flexible, which makes it expressive.

  • Morepath does not get in your way.
  • It lets you express what you want, easily. See Quickstart.
  • It’s extensible, with a simple, coherent and universal extension and override mechanism, supporting reusable code. See App Reuse.
  • It understands about generating hyperlinks. The web is about hyperlinks and Morepath actually knows about them. See Paths and Linking.
  • Views are simple functions. Generic views are just views too. See Views.
  • It has all the tools to develop REST web services in the box. See REST.

Sounds interesting?

Go on the Morepath!

Morepath Knows About Your Models

import morepath

app = morepath.App()

class Document(object):
    def __init__(self, id):
        self.id = id

@app.path(path='')
class Root(object):
    pass

@app.path(path='documents/{id}', model=Document)
def get_document(id):
    return Document(id)  # query for doc

@app.html(model=Root)
def hello_root(self, request):
    return '<a href="%s">Go to doc</a>' % request.link(Document('foo'))

@app.html(model=Document)
def hello_doc(self, request):
    return '<p>Hello document: %s!</p>' % self.id

if __name__ == '__main__':
    config = morepath.setup()
    config.scan()
    config.commit()
    morepath.run(app)

Want to know what’s going on? Check out the Quickstart!

More documentation, please!

If you have questions, please join the #morepath IRC channel on freenode. Hope to see you there!