1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/docs/Django/NOTES.txt Sun Jan 15 23:21:34 2006 +0000
1.3 @@ -0,0 +1,48 @@
1.4 +NOTE: The following examples do not currently work with Django: Auth, Calendar.
1.5 +
1.6 +WebStack supports Django in the sense that WebStack applications can be
1.7 +deployed within Django instances according to the guidelines described in the
1.8 +Django documentation plus a few caveats. Here is the basic process:
1.9 +
1.10 + 1. Create a Django instance or find an existing instance to use.
1.11 + 2. Create or find an application where WebStack resources and applications
1.12 + shall be deployed.
1.13 + 3. Add URL mappings to the instance's urls.py file - see below for a
1.14 + description of how this should be done.
1.15 + 4. Add WebStack handlers to the application directory.
1.16 +
1.17 +URL mappings
1.18 +------------
1.19 +
1.20 +The docs/Django/urls.py file contains definitions for the example applications
1.21 +based on a Django instance called "djangoinstance" (in a directory of that
1.22 +name) and the "webstack" application (in a directory of that name within the
1.23 +instance). The urls.py file employs URL patterns to direct requests to each of
1.24 +the examples.
1.25 +
1.26 +Consider the auth example - the following pattern is employed to detect
1.27 +requests intended for it:
1.28 +
1.29 +^django/webstack/auth(?P<vp>/.*)?
1.30 +
1.31 +Here, the example will be accessible via a URL like this:
1.32 +
1.33 +http://localhost/django/webstack/auth
1.34 +
1.35 +Additional path information is captured by a special named regular expression
1.36 +group which is used within the WebStack adapter.
1.37 +
1.38 +WebStack handlers and adapters
1.39 +------------------------------
1.40 +
1.41 +The handlers from examples/Django should be copied into or otherwise linked to
1.42 +from the "webstack" application directory within the Django instance. Each
1.43 +handler should contain a function, produced by calling the special deploy
1.44 +function from the Django adapter, with a name as stated in the urls.py file.
1.45 +
1.46 +Consider the auth example - the following path to the resource is stated:
1.47 +
1.48 +djangoinstance.webstack.authapp.auth
1.49 +
1.50 +Here, within the instance and application, the "authapp" handler (provided by
1.51 +the authapp.py from examples/Django) must contain a function called "auth".
2.1 --- a/docs/Django/urls.py Sun Jan 15 23:21:19 2006 +0000
2.2 +++ b/docs/Django/urls.py Sun Jan 15 23:21:34 2006 +0000
2.3 @@ -6,14 +6,20 @@
2.4 sys.path.append("/home/paulb/Software/Python/WebStack/examples/Common")
2.5 sys.path.insert(0, "/home/paulb/Software/Python/WebStack")
2.6
2.7 +# The groups defined by ?P<vp> (ie. having the name "vp") define the virtual
2.8 +# path info for each resource. Modifications to the regular expressions used
2.9 +# below should be accompanied by modifications in the handler code in
2.10 +# examples/Django.
2.11 +
2.12 urlpatterns = patterns('',
2.13 - (r'^django/webstack/auth(/.*)?', 'djangoinstance.webstack.authapp.auth'),
2.14 - (r'^django/webstack/calendar(/.*)?', 'djangoinstance.webstack.calendarapp.calendar'),
2.15 - (r'^django/webstack/cookies(/.*)?', 'djangoinstance.webstack.cookiesapp.cookies'),
2.16 - (r'^django/webstack/form(/.*)?', 'djangoinstance.webstack.formapp.form'),
2.17 - (r'^django/webstack/login(/.*)?', 'djangoinstance.webstack.loginapp.login'),
2.18 - (r'^django/webstack/sessions(/.*)?', 'djangoinstance.webstack.sessionsapp.sessions'),
2.19 - (r'^django/webstack/simple(/.*)?', 'djangoinstance.webstack.simpleapp.simple'),
2.20 - (r'^django/webstack/simplewithlogin(/.*)?', 'djangoinstance.webstack.simplewithloginapp.simplewithlogin'),
2.21 - (r'^django/webstack/verysimple(/.*)?', 'djangoinstance.webstack.verysimpleapp.verysimple'),
2.22 + (r'^django/webstack/auth(?P<vp>/.*)?', 'djangoinstance.webstack.authapp.auth'),
2.23 + (r'^django/webstack/calendar(?P<vp>/.*)?', 'djangoinstance.webstack.calendarapp.calendar'),
2.24 + (r'^django/webstack/cookies(?P<vp>/.*)?', 'djangoinstance.webstack.cookiesapp.cookies'),
2.25 + (r'^django/webstack/form(?P<vp>/.*)?', 'djangoinstance.webstack.formapp.form'),
2.26 + (r'^django/webstack/login(?P<vp>/.*)?', 'djangoinstance.webstack.loginapp.login'),
2.27 + (r'^django/webstack/sessions(?P<vp>/.*)?', 'djangoinstance.webstack.sessionsapp.sessions'),
2.28 + (r'^django/webstack/simplewithlogin(?P<vp>/.*)?', 'djangoinstance.webstack.simplewithloginapp.simplewithlogin'),
2.29 + (r'^django/webstack/simple(?P<vp>/.*)?', 'djangoinstance.webstack.simpleapp.simple'),
2.30 + (r'^django/webstack/unicode(?P<vp>/.*)?', 'djangoinstance.webstack.unicodeapp.unicode'),
2.31 + (r'^django/webstack/verysimple(?P<vp>/.*)?', 'djangoinstance.webstack.verysimpleapp.verysimple'),
2.32 )