paulb@557 | 1 | NOTE: The following examples do not currently work with Django: Auth, Calendar.
|
paulb@557 | 2 |
|
paulb@557 | 3 | WebStack supports Django in the sense that WebStack applications can be
|
paulb@557 | 4 | deployed within Django instances according to the guidelines described in the
|
paulb@557 | 5 | Django documentation plus a few caveats. Here is the basic process:
|
paulb@557 | 6 |
|
paulb@557 | 7 | 1. Create a Django instance or find an existing instance to use.
|
paulb@557 | 8 | 2. Create or find an application where WebStack resources and applications
|
paulb@557 | 9 | shall be deployed.
|
paulb@557 | 10 | 3. Add URL mappings to the instance's urls.py file - see below for a
|
paulb@557 | 11 | description of how this should be done.
|
paulb@557 | 12 | 4. Add WebStack handlers to the application directory.
|
paulb@557 | 13 |
|
paulb@557 | 14 | URL mappings
|
paulb@557 | 15 | ------------
|
paulb@557 | 16 |
|
paulb@557 | 17 | The docs/Django/urls.py file contains definitions for the example applications
|
paulb@557 | 18 | based on a Django instance called "djangoinstance" (in a directory of that
|
paulb@557 | 19 | name) and the "webstack" application (in a directory of that name within the
|
paulb@557 | 20 | instance). The urls.py file employs URL patterns to direct requests to each of
|
paulb@557 | 21 | the examples.
|
paulb@557 | 22 |
|
paulb@557 | 23 | Consider the auth example - the following pattern is employed to detect
|
paulb@557 | 24 | requests intended for it:
|
paulb@557 | 25 |
|
paulb@557 | 26 | ^django/webstack/auth(?P<vp>/.*)?
|
paulb@557 | 27 |
|
paulb@557 | 28 | Here, the example will be accessible via a URL like this:
|
paulb@557 | 29 |
|
paulb@557 | 30 | http://localhost/django/webstack/auth
|
paulb@557 | 31 |
|
paulb@557 | 32 | Additional path information is captured by a special named regular expression
|
paulb@557 | 33 | group which is used within the WebStack adapter.
|
paulb@557 | 34 |
|
paulb@557 | 35 | WebStack handlers and adapters
|
paulb@557 | 36 | ------------------------------
|
paulb@557 | 37 |
|
paulb@557 | 38 | The handlers from examples/Django should be copied into or otherwise linked to
|
paulb@557 | 39 | from the "webstack" application directory within the Django instance. Each
|
paulb@557 | 40 | handler should contain a function, produced by calling the special deploy
|
paulb@557 | 41 | function from the Django adapter, with a name as stated in the urls.py file.
|
paulb@557 | 42 |
|
paulb@557 | 43 | Consider the auth example - the following path to the resource is stated:
|
paulb@557 | 44 |
|
paulb@557 | 45 | djangoinstance.webstack.authapp.auth
|
paulb@557 | 46 |
|
paulb@557 | 47 | Here, within the instance and application, the "authapp" handler (provided by
|
paulb@557 | 48 | the authapp.py from examples/Django) must contain a function called "auth".
|