Left: | ||
Right: |
LEFT | RIGHT |
---|---|
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. |
Sebastian Noack
2015/03/12 09:27:51
Really worth pointing this out here? Isn't it the
Wladimir Palant
2015/03/12 16:40:01
No. Most our projects are explicitly developed for
| |
7 | 7 |
8 ## How to use ## | 8 ## How to use ## |
9 | 9 |
10 ### Running the test server ### | 10 ### Running the test server ### |
11 | 11 |
12 The test server will convert your content directory on the fly, your changes | 12 The test server will convert your content directory on the fly, your changes |
13 will become visible immediately. To run it you need: | 13 will become visible immediately. To run it you need: |
14 | 14 |
15 * Python 2.7 | 15 * Python 2.7 |
16 * [Flask](http://flask.pocoo.org/), [Jinja2](http://jinja.pocoo.org/) and | 16 * [Flask](http://flask.pocoo.org/), [Jinja2](http://jinja.pocoo.org/) and |
17 [Markdown](https://pypi.python.org/pypi/Markdown) modules (can be installed by | 17 [Markdown](https://pypi.python.org/pypi/Markdown) modules (can be installed by |
18 running `easy_install Flask Jinja2 Markdown` from the command line) | 18 running `easy_install Flask Jinja2 Markdown` from the command line) |
19 * A current copy of the | 19 * A current copy of the |
20 [cms repository](https://github.com/adblockplus/cms/) (can be | 20 [cms repository](https://github.com/adblockplus/cms/) (can be |
Sebastian Noack
2015/03/12 09:27:51
This README goes into the CMS repo, right? So any
Wladimir Palant
2015/03/12 16:40:01
Because repositories like web.adblockplus.org will
| |
21 [downloaded as ZIP file](https://github.com/adblockplus/cms/archive/master.zip ) | 21 [downloaded as ZIP file](https://github.com/adblockplus/cms/archive/master.zip ) |
22 or cloned via `git clone https://github.com/adblockplus/cms.git`) | 22 or cloned via `git clone https://github.com/adblockplus/cms.git`) |
23 | 23 |
24 Run the following command from the directory of the `cms` repository: | 24 Run the `runserver.py` script from your content directory, e.g.: |
Sebastian Noack
2015/03/12 09:27:51
How about making runserver.py run from everywhere,
Wladimir Palant
2015/03/12 16:40:01
Done.
| |
25 | 25 |
26 python runserver.py www_directory | 26 python ../cms/runserver.py |
27 | 27 |
28 Here `www_directory` should be replaced by the path to your content directory. | 28 Alternatively, the content directory could also be specified as command line |
29 This will start a local web server on port 5000, e.g. the page the page | 29 parameter of `runserver.py`. This will start a local web server on port 5000, |
30 `pages/example.md` will be accessible under `http://localhost:5000/en/example`. | 30 e.g. the page the page `pages/example.md` will be accessible under |
31 `http://localhost:5000/en/example`. | |
31 | 32 |
32 Note that the test server is inefficient and shouldn't be run in production. | 33 Note that the test server is inefficient and shouldn't be run in production. |
33 There you should generate static files as explained below. | 34 There you should generate static files as explained below. |
34 | 35 |
35 ### Generating the standalone test server ### | 36 ### Generating the standalone test server ### |
36 | 37 |
37 The standalone test server is a single binary, without any further dependencies. | 38 The standalone test server is a single binary, without any further dependencies. |
38 It can be copied to another system and will no longer require Python or any of | 39 It can be copied to another system and will no longer require Python or any of |
39 its modules. In order to generate the standalone test server you need all the | 40 its modules. In order to generate the standalone test server you need all the |
40 prerequisites required to run the test server and | 41 prerequisites required to run the test server and |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
229 * Additional variables `head` and `body` are defined with the HTML code that | 230 * Additional variables `head` and `body` are defined with the HTML code that |
230 should be added to the head and content of the page respectively. | 231 should be added to the head and content of the page respectively. |
231 | 232 |
232 By default, `default.tmpl` will be used for all pages. If other templates are | 233 By default, `default.tmpl` will be used for all pages. If other templates are |
233 defined, the pages need to choose them explicitly using the `template` setting. | 234 defined, the pages need to choose them explicitly using the `template` setting. |
234 | 235 |
235 ### Custom filters ### | 236 ### Custom filters ### |
236 | 237 |
237 The `filters` directory can define custom Jinja2 filters which will be available | 238 The `filters` directory can define custom Jinja2 filters which will be available |
238 in all Jinja2 templates. The file name defines the filter name, e.g. | 239 in all Jinja2 templates. The file name defines the filter name, e.g. |
239 `myfilter.py` will define a file named `myfilter`. This file should also contain | 240 `myfilter.py` will define a filter named `myfilter`. This file should also |
Sebastian Noack
2015/03/12 09:27:51
I suppose you mean "will define a filter name `myf
Wladimir Palant
2015/03/12 16:40:01
Done.
| |
240 a function called `myfilter`, this one will be called when the filter is | 241 contain a function called `myfilter`, this one will be called when the filter is |
241 invoked. For more information on Jinja2 filters see | 242 invoked. For more information on Jinja2 filters see |
242 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters). | 243 [official documentation](http://jinja.pocoo.org/docs/dev/api/#writing-filters). |
LEFT | RIGHT |