Silk will execute scripts ending in .py within a Python FCGI handler that runs within the WSGI model. Scripts will be dynamically loaded as modules on the first request, and their 'request_handler' attribute should be set to the instance of a function implementing the start_response() callable.
Example Python WSGI script
1 2 3 4 5 6 7
def my_handler(environ, start_response): start_response('200 OK', [('Content-Type', 'text/plain')]) yield "Hello World\n" for k, v in sorted(environ.items()): yield "%s: %s\n" % (k, v) request_handler = my_handler
The environment variable
wsgi_max_requests can be set to cause the FCGI wrapper to reload your Python script (module) every N requests. During development, you can set this to something very low to see incremental changes as you work. Otherwise, the FCGI wrapper will cache your code for
For example, in your .htaccess file:
SetEnv wsgi_max_requests 10