README.md 2.72 KB
Newer Older
Thom Wiggers's avatar
Thom Wiggers committed
1
2
3
4
5
6
Thalia Website
==============

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

Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
14
0. Get at least Python 3.6 and install pipenv and the Pillow requirements as per below.
Thom Wiggers's avatar
Thom Wiggers committed
15
1. Clone this repository
16
2. Run `pipenv install --python 3 --dev`
Thom Wiggers's avatar
Thom Wiggers committed
17
3. Run `pipenv shell`
Thom Wiggers's avatar
Thom Wiggers committed
18
19
5. `cd website`
6. `./manage.py migrate` to initialise the database
Thom Wiggers's avatar
Thom Wiggers committed
20
7. `./manage.py createsuperuser` to create the first user (note that this user won't be a member!)
21
22
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
23
24
25
26
27

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

1. In the root folder of the project, run `tox`.
28

Joren Vrancken's avatar
Joren Vrancken committed
29
You may get errors about missing interpreters. That is normal and can be
30
31
ignored. If you want to run a specific check, you can do the following:

32
    tox -e flake8           # Runs the flake8 linter
33
    tox -e py36-django20    # runs the tests with python 3.6 and Django 2.0
Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
34
    tox -e py37-django20    # runs the tests with python 3.7 and Django 2.0
35
36

You can run `tox -l` to see the available environments.
Thom Wiggers's avatar
Thom Wiggers committed
37

Thom Wiggers's avatar
Thom Wiggers committed
38
39
40
41
42
43
44
Pipenv
------

Install Pipenv per the [pipenv documentation][pipenv install]

[pipenv install]: https://docs.pipenv.org/install/#installing-pipenv

Thom Wiggers's avatar
Thom Wiggers committed
45
46
47
Pillow dependencies
-------------------

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

Sébastiaan Versteeg's avatar
Sébastiaan Versteeg committed
50
    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
51

Thom Wiggers's avatar
Thom Wiggers committed
52
53
54
55
Or try:

    apt-get build-dep python3-pil

Luuk Scholten's avatar
Luuk Scholten committed
56
For other operating systems, see the [Pillow Documentation][pillow-install].
Thom Wiggers's avatar
Thom Wiggers committed
57
58
59


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

Joost Rijneveld's avatar
Joost Rijneveld committed
61
62
63
64
65
66
67
Thabloid dependencies
---------------------

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

    apt-get install ghostscript

68
69
70
71
72
73
74
Translating
------------------

Make sure to use British English.

To create translations for your app:

75
1. `cd` into the application's directory
76
2. `../manage.py makemessages --locale nl --no-obsolete`
77
78
79
80
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94

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.

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