|
1 | 1 | pythonineducation.org |
2 | 2 | ===================== |
3 | 3 |
|
4 | | -The pythonineducation.org website |
| 4 | +.. image:: https://travis-ci.org/python/pythonineducation.org.svg?branch=master |
| 5 | + :target: https://travis-ci.org/python/pythonineducation.org |
| 6 | + |
| 7 | +This is the website for the http://pythonineducation.org/ website. It is hosted |
| 8 | +via GitHub Pages. |
| 9 | + |
| 10 | +If you have a suggestion to make, please feel free to create an issue_. |
| 11 | + |
| 12 | +We welcome pull requests for improvements! (Please see CONTRIBUTING.rst_ for |
| 13 | +more details). |
| 14 | + |
| 15 | +Development |
| 16 | +~~~~~~~~~~~ |
| 17 | + |
| 18 | +This site uses wok_. To install wok and other dependencies, run |
| 19 | +``pip install -r requirements.txt``. wok currently only works with Python2.7. |
| 20 | + |
| 21 | +wok build the site by assembling several components: |
| 22 | + |
| 23 | +* Pages are found in ``content/``. Pages may be HTML, Markdown_ or reStrcturedText_, and contain some YAML metadata. |
| 24 | +* Statuc files are found in ``media/``. |
| 25 | +* The various jinja2_ templates for pages can be found in ``templates/``. |
| 26 | + |
| 27 | +To build the site, run ``make build``. This pulls together all the components |
| 28 | +into a set of HTML files in ``output/``. |
| 29 | + |
| 30 | +Windows users: you need to run the (extensionless) ``wok`` script in |
| 31 | +``c:\pythonxx\scripts``. e.g. ``py -2 c:\python27\scripts\wok``. |
| 32 | + |
| 33 | +Alternatively, if you run ``make serve``, wok will build the site, serve the |
| 34 | +built site on port 8000, and watch for changes. |
| 35 | + |
| 36 | +Windows users: you ned to run the (extensionless) ``work`` script with the |
| 37 | +``--serve`` parameter in ``c:\pythonxx\scripts``. e.g. |
| 38 | +``py -2 c:\python27\scripts\wok --serve``. |
| 39 | + |
| 40 | +You can test that the site contains no broken links and that various common |
| 41 | +mis-spellings are caught correctly (hint, it's a "BBC micro:bit" for example) |
| 42 | +by running ``make test``. |
| 43 | + |
| 44 | +Travis will test branches, and branches won't get merged without review and |
| 45 | +passing tests, so dive in! |
| 46 | + |
| 47 | + |
| 48 | +Internationalisation |
| 49 | +~~~~~~~~~~~~~~~~~~~~ |
| 50 | + |
| 51 | +Python is used all over the world. Education takes place all over the world! |
| 52 | + |
| 53 | +This site should be available to people for whom English is not a native |
| 54 | +language. |
| 55 | + |
| 56 | +As a result and *from the very start of our development process* we have made |
| 57 | +it easy for contributions to be made in different languages. Here's how it |
| 58 | +works: |
| 59 | + |
| 60 | +* Each language specific version of the site lives under a path containing the |
| 61 | + `ISO 639-1 <https://en.wikipedia.org/wiki/ISO_639-1>`_ language code. For |
| 62 | + example, the English version is found under the ``/en`` path whereas the |
| 63 | + German version is under the ``/de`` path. |
| 64 | +* In the ``template/`` directory of this repository as the page templates for |
| 65 | + different languages. All inherit from the ``base.html`` template. They are |
| 66 | + named ``page_XX.html`` where XX is the appropriate ISO 639-1 code for the |
| 67 | + language for which the template is used. For example, English content uses |
| 68 | + the ``page_en.html`` template whereas the German template is |
| 69 | + ``page_de.html``. These pages should contain the localised header and footer. |
| 70 | +* In the ``content/`` directory of this repository are directories named after |
| 71 | + the ISO 639-1 language code. They contain the content for this website in |
| 72 | + the langauge referenced by the language code in the name of the directory. |
| 73 | + For example, the English content is found in the ``content/en/`` directory |
| 74 | + whereas the German content is in ``content/de/``. You must make sure that |
| 75 | + the ``type`` field in the YAML header for the content is set to the correct |
| 76 | + page template for the language. |
| 77 | +* If in doubt, just look at what happens in the English version of the site and |
| 78 | + adapt to the desired language. |
| 79 | + |
| 80 | +Deployment |
| 81 | +~~~~~~~~~~ |
| 82 | + |
| 83 | +The site is hosted as a Project Page on GitHub Pages, and so it is the |
| 84 | +``gh-pages`` branch of the repository that gets served. wok generates the site |
| 85 | +in the ``output/`` directory, and Travis is configured to push any changes to |
| 86 | +the ``output/`` directory to this branch. See ``deploy.sh`` for details. |
| 87 | + |
| 88 | +This should be done automatically by Travis after it has built the ``master`` |
| 89 | +branch, but in case this does not happen, somebody with commit access to the |
| 90 | +repository can run ``make deploy``. |
| 91 | + |
| 92 | +When setting up Travis to run this initially you must provide an OAuth token |
| 93 | +for authentication in the ``GH_TOKEN`` env var. To do this create a |
| 94 | +`Personal Access Token on GitHub <https://github.com/settings/tokens>`_ then |
| 95 | +create the ``GH_TOKEN`` key pair on the Travis |
| 96 | +`settings page <https://travis-ci.org/python/pythonineducation.org/settings>`_ |
| 97 | +for the project. |
| 98 | + |
| 99 | +Note: this is tied to a single user on GitHub, however any other GitHub user |
| 100 | +with valid permissions can replace the key on Travis. |
| 101 | + |
| 102 | +.. _wok: http://wok.mythmon.com/ |
| 103 | +.. _Markdown: https://pythonhosted.org/Markdown/ |
| 104 | +.. _reStructuredText: http://docutils.sourceforge.net/rst.html |
| 105 | +.. _jinja2: http://jinja.pocoo.org/ |
| 106 | +.. _issue: https://github.com/python/pythonineducation.org/issues |
| 107 | +.. _CONTRIBUTING.rst: ./CONTRIBUTING.rst |
0 commit comments