Skip to content
This repository has been archived by the owner on Jan 17, 2019. It is now read-only.

Build: Windows

rhyst edited this page May 23, 2017 · 5 revisions

If you want to be able to build and deploy the site yourself look here, otherwise ignore.

Installing Pelican

Installing python

First get Python 3. Python 2 will not work, it doesn't do unicode easily so I can't be bothered with it.

When using the GUI installer, select custom install and ensure that 'add to path' is checked. Otherwise you will need to add the Python directory to your path manually.

Adding Python to our path means we can use python and its modules in command prompt without typing out the whole path the Python install directory. It is important that you only have Python3 on your path.

Virtualenv - recommended

Open a cmd terminal (press windows key, type cmd). Ensure you have virtualenv installed using pip by typing the following into the cmd terminal:

pip install virtualenv

Then press enter. Once it's done navigate to the repo (either using the cmd prompt or just in windows explorer) and run the install script (by double clicking in windows explorer or by typing its name and pressing enter in cmd prompt):

win_install.bat

This will create a virtual env folder .env in the root of the repo (it won't be tracked in git). All of the required python packages will be installed here.

Make your changes to the site (Adding reports etc.) and then you're ready to build the site. This takes all of the markdown and metadata and compiles it to the html that we'll put on the server. It's a good idea to test the changes you've made first so use (type or click as with the install script)::

win_testbuild.bat

Then you can (in the terminal) change to the output directory and use a simple python server to serve the site.

cd output
python -m http.server

Then open your browser and navigate to:

localhost:8000

You should see the website. Photo/videos won't show up but but other changes should. Check that yor change has made it in and that it looks alright.

Then you need to build the site (and incorporate any changes) for real. This is different because we need to use a slightly different url format to serve from the union server than we do when serving locally. Run the build script.

win_build.bat

To push the site to the union server (and therefore make it live) you will need sftp access (can be requested via a sysadmin form). Then you run or double click:

win_deploy.bat

And the contents of the output folder will be uploaded to the server. When it finishes any changes should be visible on the website!

Thats it!

Without virtualenv (not recommended):

Install Python as above. Pelican is a python based static site generator. Install it:

pip install pelican

Install the Markdown package as that is what the trip reports should be written in:

pip install Markdown

Install BeautifulSoup:

pip install beautifulsoup4

Then to build the site run:

pelican content -s publishconf.py

To push to server see above comment in virtualenv section.