/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/en/user-guide/http_smart_server.txt

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 18:10:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6623.
  • Revision ID: jelmer@jelmer.uk-20170521181028-zn04pdfw0od9hfj3
Rename brzlib => breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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.
102
102
 
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
104
104
following line::
105
105
 
106
106
            PythonPath "sys.path+['/srv/example.com/scripts']"
153
153
Here's what it looks like::
154
154
 
155
155
    import fcgi
156
 
    from brzlib.transport.http import wsgi
 
156
    from breezy.transport.http import wsgi
157
157
 
158
158
    smart_server_app = wsgi.make_app(
159
159
        root='/srv/example.com/www/code',
179
179
Here's what it looks like::
180
180
 
181
181
    import modpywsgi
182
 
    from brzlib.transport.http import wsgi
 
182
    from breezy.transport.http import wsgi
183
183
 
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::
212
212
 
213
 
    from brzlib.transport.http import wsgi
 
213
    from breezy.transport.http import wsgi
214
214
 
215
215
    def application(environ, start_response):
216
216
        app = wsgi.make_app(
240
240
 
241
241
  * to construct a `SmartWSGIApp`, you need to specify a **root transport** that it
242
242
    will serve.
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.
244
244
 
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'.
252
252
 
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.
257
257
 
258
258
.. _WSGI standard: http://www.python.org/dev/peps/pep-0333/