| OLD | NEW |
| 1 # CMS # | 1 # CMS # |
| 2 | 2 |
| 3 We use this CMS for [adblockplus.org](https://github.com/adblockplus/web.adblock
plus.org/) | 3 We use this CMS for [adblockplus.org](https://github.com/adblockplus/web.adblock
plus.org/) |
| 4 and related websites. It converts a directory with content data into static | 4 and related websites. It converts a directory with content data into static |
| 5 files. You are free to use it for other projects but please keep in mind that we | 5 files. You are free to use it for other projects but please keep in mind that we |
| 6 make no stability guarantees whatsoever and might change functionality any time. | 6 make no stability guarantees whatsoever and might change functionality any time. |
| 7 | 7 |
| 8 ## How to use ## | 8 ## How to use ## |
| 9 | 9 |
| 10 ### Running the test server ### | 10 ### Running the test server ### |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 Run the `runserver.py` script from your content directory, e.g.: | 27 Run the `runserver.py` script from your content directory, e.g.: |
| 28 | 28 |
| 29 python ../cms/runserver.py | 29 python ../cms/runserver.py |
| 30 | 30 |
| 31 Alternatively, the content directory could also be specified as command line | 31 Alternatively, the content directory could also be specified as command line |
| 32 parameter of `runserver.py`. This will start a local web server on port 5000, | 32 parameter of `runserver.py`. This will start a local web server on port 5000, |
| 33 e.g. the page the page `pages/example.md` will be accessible under | 33 e.g. the page the page `pages/example.md` will be accessible under |
| 34 `http://localhost:5000/en/example`. | 34 `http://localhost:5000/en/example`. |
| 35 | 35 |
| 36 Sometimes it is useful to test the interaction between some dynamic URL handlers |
| 37 as defined in the sitescripts repository with an otherwise static site that has |
| 38 been generated by our CMS. To do this clone the sitescripts repository and |
| 39 configure the required URL handlers in the `multiplexer` section of your |
| 40 sitescripts.ini file. Then launch the CMS test server making sure to specify the |
| 41 `PYTHONPATH` environment variable: |
| 42 |
| 43 PYTHONPATH=/path/to/sitescripts ../cms/runserver.py |
| 44 |
| 45 _(URL handlers from sitescripts will take precedence over static files and |
| 46 pages.)_ |
| 47 |
| 36 Note that the test server is inefficient and shouldn't be run in production. | 48 Note that the test server is inefficient and shouldn't be run in production. |
| 37 There you should generate static files as explained below. | 49 There you should generate static files as explained below. |
| 38 | 50 |
| 39 ### Generating the standalone test server ### | 51 ### Generating the standalone test server ### |
| 40 | 52 |
| 41 The standalone test server is a single binary, without any further dependencies. | 53 The standalone test server is a single binary, without any further dependencies. |
| 42 It can be copied to another system and will no longer require Python or any of | 54 It can be copied to another system and will no longer require Python or any of |
| 43 its modules. In order to generate the standalone test server you need all the | 55 its modules. In order to generate the standalone test server you need all the |
| 44 prerequisites required to run the test server and | 56 prerequisites required to run the test server and |
| 45 [PyInstaller](https://github.com/pyinstaller/pyinstaller/wiki). PyInstaller can | 57 [PyInstaller](https://github.com/pyinstaller/pyinstaller/wiki). PyInstaller can |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 filter is invoked. For more information on Jinja2 filters see | 326 filter is invoked. For more information on Jinja2 filters see |
| 315 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters). | 327 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters). |
| 316 | 328 |
| 317 ### Custom functions and variables ### | 329 ### Custom functions and variables ### |
| 318 | 330 |
| 319 The `globals` directory can define custom Jinja2 globals which will be available | 331 The `globals` directory can define custom Jinja2 globals which will be available |
| 320 in all Jinja2 templates. Typically, this is used for custom functions. The file | 332 in all Jinja2 templates. Typically, this is used for custom functions. The file |
| 321 name should match the name of the function or variable to be defined, and export | 333 name should match the name of the function or variable to be defined, and export |
| 322 a variable with that name. E.g. `globals/myfunction.py` can define a function | 334 a variable with that name. E.g. `globals/myfunction.py` can define a function |
| 323 called `myfunction` that will become available to all Jinja2 templates. | 335 called `myfunction` that will become available to all Jinja2 templates. |
| OLD | NEW |