The BaseApplication is the most simple application type. All other application types inherit from BaseApplication.
So all the code found here will also work in other application types.
Default usage:
from colubrid import BaseApplication, HttpResponse, execute
class MyApplication(BaseApplication):
def process_request(self):
name = self.request.args.get('name', 'World')
response = HttpResponse('Hello %s!' % name)
response['Content-Type'] = 'text/plain'
return response
app = MyApplication
if __name__ == '__main__':
execute(app)
When the user requests a page, Python calls the process_request method and passes the result to the wsgi server.