Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Teeny-tiny MVC styled framework for Python and WSGI
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

About MicroMVC

MicroMVC is a simplistic framework integrated with eventlet and Cheetah for writing quick web applications in Python. It's partially modeled after ASP.NET MVC in the terminology and structure of a given web application, but that's where the similarities end.

Getting Started

The structure I use with MicroMVC is:


The file is there more for my own convenience and contains:

#!/usr/bin/env python
import sys
import MicroMVC
import MyApp

def main():
    app = MyApp.MyApplication()

if __name__ == '__main__':

Structuring your MicroMVC.Application subclass is quite easy as well:

#!/usr/bin/env python
import MicroMVC

from MyApp import controllers
from MyApp import views

class MyApplication(MicroMVC.Application):
    controller_dir = 'MyApp.controllers'
    views_dir = 'MyApp.views'
    def controllers(self):
        return controllers
    def views(self):
        return views

It is worth noting that controller_dir and views_dir both exist to help MicroMVC properly import packages and their existence will be soon obsoleted.

Writing a controller

Controllers are where a lot of the work to set up a view is done, with MicroMVC you can use controllers to determine the output content-type of your view as well as the URL routing for your view via the MicroMVC.controller.action decorator. Below is a simple example controller:

#!/usr/bin/env python
from MicroMVC impor controller

class home(controller.BaseController):
    content_type = 'text/html'

    @controller.action(paths=('/', '/index.html',))
    def index(self, **kwargs):
        return self.render('index', user='New User')

Walking through the controller from top to bottom, we are doing a few different things in a very small amount of code:

  • Determine that all "actions" in the home controller will have the content-type of "text/html" (note: default is text/plain)
  • Map the home.index action to http://host/, http://host/index.html; additionally the action is mapped by default to http://host/home/index
  • Render the view "index" (MyApp/views/index.tmpl) passing in the $user variable

Writing a view

Views are simply pre-compiled Cheetah templates


  • Parameterized paths for actions
  • Models!
Something went wrong with that request. Please try again.