class waffleweb.WaffleApp()

The WaffleApp object is the center of your web application.

route(path='/', name=None, methods=['GET'])

A decorator to route a function to an URL.

  • path (str) - The path to your view.

  • name (str) - The name of your view.

  • methods (list[str]) - The allowed methods for your view.


A decorator to route a function to a certain error code. Whenever you return a response with a status code a errorHandler will be looked for with that status code. it will return your errorHandler.

  • statusCode (int) - The status code to route the function to.


Sends a request to any of the views. It’s main use is for the testing of waffleweb. It goes through the normal process that the requests takes when going through the server, except it doesn’t go through a server.

  • rawRequest (bytes) - A byte request.

Returns: Response


from waffleweb import WaffleApp

app = WaffleApp('appName')

def index(request):
    return HTTPResponse(request, 'index')

res = app.request(b'GET /index HTTP/1.1\r\nHeader-Name: value\r\n\r\n')

run(host='', port=8000, debug=False)

Runs a test server. This shouldn’t be used in production as it does not have any security checks.

  • host (optional) (str) - The host of your website.

  • port (optional) (int) - The port of your website.

  • debug (optional) (bool) - If your server is in debug mode.

Returns: None

wsgiApplication(environ, startResponse)

A WSGI application. As outlined in PEP 3333.

  • environ (dict) - For your wsgi server gateway. As outlined in PEP 3333.

  • startResponse (func) - For your wsgi server gateway. As outlined in PEP 3333.

Returns: iter()

class, path, splitPath, name, view, allowedMethods)

A class to store views.

  • unstripedPath (optional) (str) - The unstriped, raw path of the view.

  • path (optional) (str) - The striped path of the view. The slashes are striped off the path.

  • splitPath (optional) (list) - The path split by slashes.

  • name (optional) (str) - The name of the view.

  • view (optional) (func) - The view function.

  • allowedMethods (optional) (list) - The allowed methods of the view.


Checks whether or not the path of the view has variables in it.

class, view)

A class to store error handlers.

  • statusCode (optional) (int) - The status code that the handler handles.

  • view (optional) (func) - The view function.