Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 # Sitescripts | 1 # Sitescripts |
2 | 2 |
3 ## Introduction | 3 ## Introduction |
4 | 4 |
5 The sitescripts repository contains many of the server side Python scripts that | 5 The sitescripts repository contains many of the server side Python scripts that |
6 we use. There are both web handlers, which can be used via the multiplexer, and | 6 we use. There are both web handlers, which can be used via the multiplexer, and |
7 scripts that perform other tasks. | 7 scripts that perform other tasks. |
8 | 8 |
9 The scripts are often unrelated and as such will not all be documented here. For | 9 The scripts are often unrelated and as such will not all be documented here. For |
10 more information about the individual scripts you will need to look at their | 10 more information about the individual scripts you will need to look at their |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 in PEP-333](https://www.python.org/dev/peps/pep-0333/). They will almost always | 58 in PEP-333](https://www.python.org/dev/peps/pep-0333/). They will almost always |
59 use some of the decorators and utilities that are provided by `sitescripts.web`, | 59 use some of the decorators and utilities that are provided by `sitescripts.web`, |
60 for example the `url_handler` decorator which registers a handling function with | 60 for example the `url_handler` decorator which registers a handling function with |
61 the multiplexer for the given path. | 61 the multiplexer for the given path. |
62 | 62 |
63 The multiplexer imports each module that's listed in the `multiplexer` section | 63 The multiplexer imports each module that's listed in the `multiplexer` section |
64 of the sitescripts configuration file, before providing a WSGI app that serves | 64 of the sitescripts configuration file, before providing a WSGI app that serves |
65 any URL handlers that they have registered. | 65 any URL handlers that they have registered. |
66 | 66 |
67 This WSGI app can then be served using `multiplexer.fcgi` in production, or | 67 This WSGI app can then be served using `multiplexer.fcgi` in production, or |
68 `multiplexer.py` in development. `multiplexer.fcgi` is simply a FCGI script and | 68 `multiplexer.py` in development. `multiplexer.fcgi` is a FCGI script and depends |
69 depends on [the flup package](http://www.saddi.com/software/flup/). | 69 on [the flup package](http://www.saddi.com/software/flup/). |
70 `multiplexer.py` provides a complete web server and only optionally depends on | 70 `multiplexer.py` provides a complete web server and only optionally depends on |
71 [the werkzeug package](http://werkzeug.pocoo.org/). (If werkzeug is available | 71 [the werkzeug package](http://werkzeug.pocoo.org/). (If werkzeug is available |
72 its debugging facilities will be used.) | 72 its debugging facilities will be used.) |
73 | 73 |
74 So, to test any of the URL handlers in development simply do the following: | 74 So, to test any of the URL handlers in development do the following: |
Wladimir Palant
2015/10/06 18:39:36
Nit: too many "simply" - this usually indicates th
kzar
2015/10/07 13:36:27
Done.
| |
75 | 75 |
76 1. Create a sitescripts configuration file that lists the web modules that you | 76 1. Create a sitescripts configuration file that lists the web modules that you |
77 are testing under the `multiplexer` section. (Depending on the modules you are | 77 are testing under the `multiplexer` section. (Depending on the modules you are |
78 testing you may need to add additional configuration as well.) | 78 testing you may need to add additional configuration as well.) |
79 2. Save the configuration file somewhere where it will be found, for example | 79 2. Save the configuration file somewhere where it will be found, for example |
80 `~/.sitescripts`. | 80 `~/.sitescripts`. |
81 3. Type `python multiplexer.py`, it will start a web server locally on port | 81 3. Type `python multiplexer.py`, it will start a web server at |
82 5000. This web server will use any URL handlers that have been defined in the | 82 http://localhost:5000/ . This web server will use any URL handlers that have |
Wladimir Palant
2015/10/06 18:39:36
"locally on port 5000" => "at http://localhost:500
kzar
2015/10/07 13:36:27
Done.
| |
83 modules you are testing to respond to requests. | 83 been defined in the modules you are testing to respond to requests. |
LEFT | RIGHT |