README.md 3.55 KB
Newer Older
1
Thalia Website [![coverage report](https://gitlab.science.ru.nl/thalia/concrexit/badges/master/coverage.svg)](https://thalia-coverage.s3.amazonaws.com/master/index.html)
Thom Wiggers's avatar
Thom Wiggers committed
2 3 4 5 6
==============

New new Thalia website, now with extra Django.

    #Concrexit
Thom Wiggers's avatar
Thom Wiggers committed
7

8

Thom Wiggers's avatar
Thom Wiggers committed
9 10 11
Getting started
---------------

12
If you use Docker, please look at [this part](#docker) of the README.
13

Jelle Besseling's avatar
Jelle Besseling committed
14
0. Get at least Python 3.6 and install poetry and the Pillow requirements as per below.
Thom Wiggers's avatar
Thom Wiggers committed
15
1. Clone this repository
Jelle Besseling's avatar
Jelle Besseling committed
16 17 18
2. Make sure `poetry` uses your python 3 installation: `poetry env use python3`
3. Run `poetry install`
4. Run `poetry shell`
Thom Wiggers's avatar
Thom Wiggers committed
19 20
5. `cd website`
6. `./manage.py migrate` to initialise the database
Thom Wiggers's avatar
Thom Wiggers committed
21
7. `./manage.py createsuperuser` to create the first user (note that this user won't be a member!)
22 23
8. `./manage.py createfixtures -a` to generate a bunch of test data
9. `./manage.py runserver` to run a testing server
Thom Wiggers's avatar
Thom Wiggers committed
24 25 26 27

Testing and linting
-------------------

Jelle Besseling's avatar
Jelle Besseling committed
28 29
You can use [`pyenv`](https://github.com/pyenv/pyenv) (on Unix systems) to test in different python
environments.
30

Luko van der Maas's avatar
Luko van der Maas committed
31 32
All code has to be run through [`black`](https://github.com/psf/black) before being committed. To black the code before committing make run `black` one the base directory of this project.
If you want to integrate `black` with your editor look in the [`black` docs](https://black.readthedocs.io/en/stable/editor_integration.html). On linux you can find the black executable in `~/.cache/poety/virtualenvs/<your env>/bin/black`.
33

Jelle Besseling's avatar
Jelle Besseling committed
34
There are a range of tests that can be run:
Thom Wiggers's avatar
Thom Wiggers committed
35

36 37 38 39 40
    poetry run python website/manage.py check
    poetry run python website/manage.py templatecheck --project-only
    poetry run python website/manage.py makemigrations --no-input --check --dry-run
    poetry run coverage run website/manage.py test website/
    poetry run coverage report
Jelle Besseling's avatar
Jelle Besseling committed
41 42

poetry
Thom Wiggers's avatar
Thom Wiggers committed
43 44
------

45
Install poetry per the [poetry documentation][poetry install]. Make sure you install at least version 1.x.x, choose the prerelease version if necessary.
Thom Wiggers's avatar
Thom Wiggers committed
46

Jelle Besseling's avatar
Jelle Besseling committed
47
[poetry install]: https://github.com/sdispater/poetry#installation
Thom Wiggers's avatar
Thom Wiggers committed
48

Thom Wiggers's avatar
Thom Wiggers committed
49 50 51
Pillow dependencies
-------------------

Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
52
For Ubuntu 18.04, use:
Thom Wiggers's avatar
Thom Wiggers committed
53

Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
54
    apt-get install python3-dev gettext gcc build-essential libtiff5-dev libjpeg-turbo8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev
Thom Wiggers's avatar
Thom Wiggers committed
55

Thom Wiggers's avatar
Thom Wiggers committed
56 57 58 59
Or try:

    apt-get build-dep python3-pil

Luuk Scholten's avatar
Luuk Scholten committed
60
For other operating systems, see the [Pillow Documentation][pillow-install].
Thom Wiggers's avatar
Thom Wiggers committed
61 62 63


[pillow-install]: https://pillow.readthedocs.io/en/latest/installation.html
Luuk Scholten's avatar
Luuk Scholten committed
64

Job Doesburg's avatar
Job Doesburg committed
65 66 67

On macOS you will also need to install `libmagic`, using the brew package manager by running `brew install libmagic`.

Joost Rijneveld's avatar
Joost Rijneveld committed
68 69 70 71 72 73 74
Thabloid dependencies
---------------------

To be able to generate JPGs from PDFs, we need ghostscript:

    apt-get install ghostscript

75 76 77 78 79 80 81
Translating
------------------

Make sure to use British English.

To create translations for your app:

82
1. `cd` into the application's directory
83
2. `../manage.py makemessages --locale nl --no-obsolete`
84 85 86 87
3. This creates or updates `locale/nl/LC_MESSAGES/django.po`
4. Start poedit by calling `poedit locale/nl/LC_MESSAGES/django.po`
5. `../manage.py compilemessages` (should happen automatically when saving the file in poedit)
6. Commit both the `.po` and `.mo` file to the repository
88 89 90 91 92 93 94 95 96 97 98 99 100 101

Docker
------

First run with Docker:

1. `docker-compose up -d`
2. `docker-compose run web migrate`
3. `docker-compose run web createsuperuser`

Step 1. may take a while since `docker-compose` needs to retrieve all dependencies
and build the Docker images. Step 2. creates the necessary tables and step 3.
creates a superuser, as the command implies.

102
After step 3. you can access the Thalia website locally through http://localhost:8000/