Skip to content

Commit b784c81

Browse files
committed
Scaffolding of a bare-bones site. Fill in the gaps!
1 parent 85af6da commit b784c81

File tree

19 files changed

+404
-1
lines changed

19 files changed

+404
-1
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.venv
2+
output
3+
.sass-cache
4+
*.swp
5+
*.pyc
6+
7+
.DS_Store

.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
language: python
2+
sudo: false
3+
4+
cache:
5+
directories:
6+
- $HOME/.cache/pip
7+
8+
install:
9+
- pip install --disable-pip-version-check --upgrade pip
10+
- pip install -r requirements.txt
11+
12+
script: make test
13+
14+
after_success: make deploy

Makefile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.PHONY: help build serve test deploy
2+
3+
help:
4+
@echo 'Makefile for pythonineducation.org'
5+
@echo ''
6+
@echo 'Usage:'
7+
@echo ' make build build the site into the output directory'
8+
@echo ' make serve build the site and serve on port 8000, watching for changes'
9+
@echo ' make test test that site builds, has no broken links, and spells the conference name correctly'
10+
@echo ' make deploy deploy site'
11+
@echo ''
12+
13+
build:
14+
wok
15+
16+
serve:
17+
wok --serve
18+
19+
test:
20+
./pre-flight-checks.sh
21+
22+
deploy:
23+
./deploy.sh

README.rst

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,107 @@
11
pythonineducation.org
22
=====================
33

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

config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
url_pattern: /{slug}/index.html

content/CNAME

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
url: CNAME
2+
type: none
3+
---
4+
pythonineducation.org

content/de/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type: page_de
2+
category: home
3+
slug: index
4+
url: /de/index.html
5+
title: Python in der Bildung
6+
---
7+
8+
#Demnächst!#
9+
10+
(Auf Deutsch)

content/en/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
type: page_en
2+
category: home
3+
slug: index
4+
url: /en/index.html
5+
title: Python in Education
6+
---
7+
8+
#Coming soon!#
9+
10+
(In English)

content/index.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
type: page_en
2+
slug: home
3+
url: index.html
4+
title: Python in Education
5+
---
6+
7+
#Coming soon!#

deploy.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [[ $TRAVIS = "true" ]]; then
6+
if [[ $TRAVIS_BRANCH != "master" || $TRAVIS_PULL_REQUEST != "false" ]]; then
7+
# Bail out if Travis is building a branch or is building a Pull Request.
8+
echo "Not deploying!"
9+
exit 0
10+
fi
11+
12+
REPO_URL="https://PYTHON-USER@github.com/python/pythonineducation.org"
13+
14+
# Set up credentials for pushing to GitHub. $GH_TOKEN is configured via Travis web UI.
15+
git config --global credential.helper "store --file=$TRAVIS_BUILD_DIR/git-credentials"
16+
echo "https://PYTHON-USER:$GH_TOKEN@github.com" > $TRAVIS_BUILD_DIR/git-credentials
17+
18+
# Set up config for committing.
19+
git config --global user.name "Travis"
20+
git config --global user.email "no-reply@python.org"
21+
else
22+
REPO_URL="git@github.com:python/pythonineducation.org.git"
23+
fi
24+
25+
echo "Deploying!"
26+
27+
# Remove output directory and replace it with the current tip of the gh-pages branch.
28+
rm -rf output
29+
git clone $REPO_URL --branch gh-pages --single-branch output
30+
31+
# Update the output directory with recent changes.
32+
make build
33+
34+
# Add, commit, and push any changes.
35+
cd output
36+
git add .
37+
git commit -m "[skip ci] Auto-commit. Built latest changes."
38+
git push $REPO_URL gh-pages
39+
40+
# Clean up.
41+
rm -rf .git

0 commit comments

Comments
 (0)