100
100
This instructs Apache to hand requests for any URL ending with `/.brz/smart`
101
101
inside `/code` to a Breezy smart server via mod_python.
103
NOTE: If you don't have brzlib in your PATH, you will be need to change the
103
NOTE: If you don't have breezy in your PATH, you will be need to change the
106
106
PythonPath "sys.path+['/srv/example.com/scripts']"
153
153
Here's what it looks like::
156
from brzlib.transport.http import wsgi
156
from breezy.transport.http import wsgi
158
158
smart_server_app = wsgi.make_app(
159
159
root='/srv/example.com/www/code',
179
179
Here's what it looks like::
182
from brzlib.transport.http import wsgi
182
from breezy.transport.http import wsgi
184
184
smart_server_app = wsgi.make_app(
185
185
root='/srv/example.com/www/code',
210
210
to write to configure a smart server, and glue it to the WSGI gateway.
211
211
Here's what it looks like::
213
from brzlib.transport.http import wsgi
213
from breezy.transport.http import wsgi
215
215
def application(environ, start_response):
216
216
app = wsgi.make_app(
241
241
* to construct a `SmartWSGIApp`, you need to specify a **root transport** that it
243
* each request's `environ` dict must have a **'brzlib.relpath'** variable set.
243
* each request's `environ` dict must have a **'breezy.relpath'** variable set.
245
245
The `make_app` helper used in the example constructs a `SmartWSGIApp` with a
246
246
transport based on the `root` path given to it, and calculates the
247
'brzlib.relpath` for each request based on the `prefix` and `path_var`
247
'breezy.relpath` for each request based on the `prefix` and `path_var`
248
248
arguments. In the example above, it will take the 'REQUEST_URI' (which is set
249
249
by Apache), strip the '/code/' prefix and the '/.brz/smart' suffix, and set that
250
as the 'brzlib.relpath', so that a request for '/code/foo/bar/.brz/smart' will
251
result in a 'brzlib.relpath' of 'foo/brz'.
250
as the 'breezy.relpath', so that a request for '/code/foo/bar/.brz/smart' will
251
result in a 'breezy.relpath' of 'foo/brz'.
253
253
It's possible to configure a smart server for a non-local transport, or that
254
254
does arbitrary path translations, etc, by constructing a `SmartWSGIApp`
255
directly. Refer to the docstrings of `brzlib.transport.http.wsgi` and the `WSGI
255
directly. Refer to the docstrings of `breezy.transport.http.wsgi` and the `WSGI
256
256
standard`_ for further information.
258
258
.. _WSGI standard: http://www.python.org/dev/peps/pep-0333/