ModjyLocateCallables
Version 3 (Alan Kennedy, 03/16/2009 04:22 pm)
| 1 | 1 | h1. Writing applications with modjy. |
|
|---|---|---|---|
| 2 | 1 | ||
| 3 | 1 | h2(#locating_callables). How modjy locates application callable objects. |
|
| 4 | 1 | ||
| 5 | 1 | According to the "WSGI specification":http://www.python.org/dev/peps/pep-0333/, all WSGI applications must be python callable objects, taking a defined parameter list. Application callables can be python "functions":http://docs.python.org/ref/function.html, class instances with a "__call__()":http://docs.python.org/ref/callable-types.html method, or indeed "any callable object":http://docs.python.org/ref/calls.html. |
|
| 6 | 1 | ||
| 7 | 1 | There are two different mechanisms by which you can specify application callable objects to modjy. They are |
|
| 8 | 1 | ||
| 9 | 1 | ||
| 10 | 3 | Alan Kennedy | # By specifying a single importable name. This requires specifying the name fully-package-qualified name of an importable WSGI handler, e.g. *some_framework.web.handlers.WSGIHandler*. This is the preferred mechanism, and takes precedence over the other mechanism, if configuration values are provided for both import mechanisms. To read more about this mechanism, see the [[ModjyAppImportable|importing applications page]]. |
| 11 | 3 | Alan Kennedy | # By specifying a combination of three names, a *directory name*, a *file name*, and a *callable name*. To read more about this mechanism, see the [[ModjyAppExecFile|execfile page]] |
| 12 | 1 | ||
| 13 | 3 | Alan Kennedy | If configuration values for both of these mechanisms is provided, then the [[ModjyAppImportable|importable mechanism]] takes precedence. |