1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-11-26 18:37:12 +00:00

Merge branch 'debian_deps' into 'beta'

Debian deps

See merge request bde/nk20!103
This commit is contained in:
erdnaxe 2020-09-01 16:09:00 +02:00
commit 08defd84e6
19 changed files with 165 additions and 202 deletions

View File

@ -1,25 +1,51 @@
image: python:3.8
stages: stages:
- test - test
- quality-assurance - quality-assurance
before_script: # Debian Buster
- pip install tox
py37-django22: py37-django22:
image: python:3.7
stage: test stage: test
image: debian:buster-backports
before_script:
- >
apt-get update &&
apt-get install -t buster-backports -y python3-django python3-django-crispy-forms
python3-django-extensions python3-django-filters python3-django-polymorphic
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3
gettext libjs-bootstrap4 fonts-font-awesome tox &&
rm -rf /var/lib/apt/lists/*
script: tox -e py37-django22 script: tox -e py37-django22
# Ubuntu 20.04
py38-django22: py38-django22:
image: python:3.8
stage: test stage: test
image: ubuntu:20.04
before_script:
# Fix tzdata prompt
- ln -sf /usr/share/zoneinfo/Europe/Paris /etc/localtime && echo Europe/Paris > /etc/timezone
- >
apt-get update &&
apt-get install -y python3-django python3-django-crispy-forms
python3-django-extensions python3-django-filters python3-django-polymorphic
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3
gettext libjs-bootstrap4 fonts-font-awesome tox &&
rm -rf /var/lib/apt/lists/*
script: tox -e py38-django22 script: tox -e py38-django22
linters: linters:
image: python:3.8
stage: quality-assurance stage: quality-assurance
image: debian:buster-backports
before_script:
- >
apt-get update &&
apt-get install -t buster-backports -y python3-django python3-django-crispy-forms
python3-django-extensions python3-django-filters python3-django-polymorphic
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3
gettext libjs-bootstrap4 fonts-font-awesome tox &&
rm -rf /var/lib/apt/lists/*
script: tox -e linters script: tox -e linters
# Be nice to new contributors, but please use `tox` # Be nice to new contributors, but please use `tox`

View File

@ -1,27 +1,26 @@
FROM python:3-alpine FROM debian:buster-backports
# Force the stdout and stderr streams to be unbuffered
ENV PYTHONUNBUFFERED 1 ENV PYTHONUNBUFFERED 1
# Install LaTeX requirements # Install Django, external apps, LaTeX and dependencies
RUN apk add --no-cache gettext texlive texmf-dist-latexextra texmf-dist-fontsextra nginx gcc libc-dev libffi-dev postgresql-dev libxml2-dev libxslt-dev jpeg-dev RUN apt-get update && \
apt-get install -t buster-backports -y python3-django python3-django-crispy-forms \
python3-django-extensions python3-django-filters python3-django-polymorphic \
python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil \
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3 \
uwsgi uwsgi-plugin-python3 \
texlive-latex-extra texlive-fonts-extra texlive-lang-french \
gettext libjs-bootstrap4 fonts-font-awesome && \
rm -rf /var/lib/apt/lists/*
RUN apk add --no-cache bash # Instal PyPI requirements
COPY requirements.txt /var/www/note_kfet/
RUN pip3 install -r /var/www/note_kfet/requirements.txt --no-cache-dir
RUN mkdir /code # Copy code
WORKDIR /code WORKDIR /var/www/note_kfet
COPY requirements /code/requirements COPY . /var/www/note_kfet/
RUN pip install gunicorn ptpython --no-cache-dir
RUN pip install -r requirements/base.txt -r requirements/cas.txt -r requirements/production.txt --no-cache-dir
COPY . /code/ EXPOSE 8080
ENTRYPOINT ["/var/www/note_kfet/entrypoint.sh"]
# Configure nginx
RUN mkdir /run/nginx
RUN ln -sf /dev/stdout /var/log/nginx/access.log && ln -sf /dev/stderr /var/log/nginx/error.log
RUN ln -sf /code/nginx_note.conf_docker /etc/nginx/conf.d/nginx_note.conf
RUN rm /etc/nginx/conf.d/default.conf
ENTRYPOINT ["/code/entrypoint.sh"]
EXPOSE 80
CMD ["./manage.py", "shell_plus", "--ptpython"]

View File

@ -14,21 +14,25 @@ Sinon vous pouvez suivre les étapes ici.
### Installation avec Debian/Ubuntu ### Installation avec Debian/Ubuntu
1. **Installation des dépendances APT.** 1. **Installation des dépendances APT.**
On tire les dépendances le plus possible à partir des dépôts de Debian.
On a besoin d'un environnement LaTeX pour générer les factures.
```bash ```bash
$ sudo apt install nginx python3 python3-pip python3-dev uwsgi uwsgi-plugin-python3 python3-venv git acl $ sudo apt update
``` $ sudo apt install -t buster-backports -y python3-django python3-django-crispy-forms \
python3-django-extensions python3-django-filters python3-django-polymorphic \
La génération des factures de l'application trésorerie nécessite une installation de LaTeX suffisante, python3-djangorestframework python3-django-cas-server python3-psycopg2 python3-pil \
python3-babel python3-lockfile python3-pip python3-phonenumbers ipython3 \
```bash uwsgi uwsgi-plugin-python3 \
$ sudo apt install texlive-latex-extra texlive-fonts-extra texlive-lang-french texlive-latex-extra texlive-fonts-extra texlive-lang-french \
gettext libjs-bootstrap4 fonts-font-awesome \
nginx python3-venv git acl
``` ```
2. **Clonage du dépot** dans `/var/www/note_kfet`, 2. **Clonage du dépot** dans `/var/www/note_kfet`,
```bash ```bash
$ mkdir -p /var/www/note_kfet && cd /var/www/note_kfet $ sudo mkdir -p /var/www/note_kfet && cd /var/www/note_kfet
$ sudo chown www-data:www-data . $ sudo chown www-data:www-data .
$ sudo chmod g+rwx . $ sudo chmod g+rwx .
$ sudo -u www-data git clone git@gitlab.crans.org:bde/nk20.git . $ sudo -u www-data git clone git@gitlab.crans.org:bde/nk20.git .
@ -39,8 +43,7 @@ Sinon vous pouvez suivre les étapes ici.
```bash ```bash
$ python3 -m venv env $ python3 -m venv env
$ source env/bin/activate $ source env/bin/activate
(env)$ pip3 install -r requirements/base.txt (env)$ pip3 install -r requirements.txt
(env)$ pip3 install -r requirements/prod.txt # uniquement en prod, nécessite une base postgres
(env)$ deactivate # sortir de l'environnement (env)$ deactivate # sortir de l'environnement
``` ```
@ -144,30 +147,44 @@ Sinon vous pouvez suivre les étapes ici.
Il est possible de travailler sur une instance Docker. Il est possible de travailler sur une instance Docker.
1. Cloner le dépôt là où vous voulez : Pour construire l'image Docker `nk20`,
$ git clone git@gitlab.crans.org:bde/nk20.git ```
git clone https://gitlab.crans.org/bde/nk20/ && cd nk20
docker build . -t nk20
```
2. Copiez le fichier `.env_example` à la racine du projet vers le fichier `.env`, Ensuite pour lancer la note Kfet en tant que vous (option `-u`),
et mettez à jour vos variables d'environnement l'exposer sur son port 80 (option `-p`) et monter le code en écriture (option `-v`),
3. Dans le fichier `docker_compose.yml`, qu'on suppose déjà configuré, ```
ajouter les lignes suivantes, en les adaptant à la configuration voulue : docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd):/var/www/note_kfet/" -p 80:8080 nk20
```
nk20: Si vous souhaitez lancer une commande spéciale, vous pouvez l'ajouter à la fin, par exemple,
build: /chemin/vers/nk20
volumes:
- /chemin/vers/nk20:/code/
env_file: /chemin/vers/nk20/.env
restart: always
labels:
- traefik.domain=ndd.example.com
- traefik.frontend.rule=Host:ndd.example.com
- traefik.port=8000
4. Enjoy : ```
docker run -it --rm -u $(id -u):$(id -g) -v "$(pwd):/var/www/note_kfet/" -p 80:8080 nk20 python3 ./manage.py createsuperuser
```
$ docker-compose up -d nk20 #### Avec Docker Compose
On vous conseilles de faire un fichier d'environnement `.env` en prenant exemple sur `.env_example`.
Pour par exemple utiliser le Docker de la note Kfet avec Traefik pour réaliser le HTTPS,
```YAML
nk20:
build: /chemin/vers/le/code/nk20
volumes:
- /chemin/vers/le/code/nk20:/var/www/note_kfet/
env_file: /chemin/vers/le/code/nk20/.env
restart: always
labels:
- traefik.domain=ndd.example.com
- traefik.frontend.rule=Host:ndd.example.com
- traefik.port=8080
```
### Lancer un serveur de développement ### Lancer un serveur de développement
@ -183,7 +200,7 @@ un serveur de développement par exemple sur son ordinateur.
$ python3 -m venv venv $ python3 -m venv venv
$ source venv/bin/activate $ source venv/bin/activate
(env)$ pip install -r requirements/base.txt (env)$ pip install -r requirements.txt
3. Copier le fichier `.env_example` vers `.env` à la racine du projet et mettre à jour 3. Copier le fichier `.env_example` vers `.env` à la racine du projet et mettre à jour
ce qu'il faut ce qu'il faut

View File

@ -13,6 +13,8 @@
- git - git
- acl - acl
- gettext - gettext
- libjs-bootstrap4
- fonts-font-awesome
- texlive-latex-extra - texlive-latex-extra
- texlive-fonts-extra - texlive-fonts-extra
- texlive-lang-french - texlive-lang-french

View File

@ -53,7 +53,7 @@ server {
# Finally, send all non-media requests to the Django server. # Finally, send all non-media requests to the Django server.
location / { location / {
uwsgi_pass note; uwsgi_pass note;
include /var/www/note_kfet/uwsgi_params; # the uwsgi_params file you installed include /etc/nginx/uwsgi_params;
} }
ssl_certificate /etc/letsencrypt/live/nk20-beta.crans.org/fullchain.pem; ssl_certificate /etc/letsencrypt/live/nk20-beta.crans.org/fullchain.pem;

View File

@ -69,11 +69,11 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% endif %} {% endif %}
{% if can_lock_note %} {% if can_lock_note %}
<button class="btn btn-sm btn-danger" data-toggle="modal" data-target="#lock-note-modal"> <button class="btn btn-sm btn-danger" data-toggle="modal" data-target="#lock-note-modal">
<i class="fas fa-ban"></i> {% trans 'Lock note' %} <i class="fa fa-ban"></i> {% trans 'Lock note' %}
</button> </button>
{% elif can_unlock_note %} {% elif can_unlock_note %}
<button class="btn btn-sm btn-success" data-toggle="modal" data-target="#unlock-note-modal"> <button class="btn btn-sm btn-success" data-toggle="modal" data-target="#unlock-note-modal">
<i class="fas fa-check-circle"></i> {% trans 'Unlock note' %} <i class="fa fa-check-circle"></i> {% trans 'Unlock note' %}
</button> </button>
{% endif %} {% endif %}
</div> </div>

View File

@ -7,7 +7,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% block content %} {% block content %}
{% if "member.change_profile_registration_valid"|has_perm:user %} {% if "member.change_profile_registration_valid"|has_perm:user %}
<a class="btn btn-block btn-secondary mb-3" href="{% url 'registration:future_user_list' %}"> <a class="btn btn-block btn-secondary mb-3" href="{% url 'registration:future_user_list' %}">
<i class="fas fa-user-plus"></i> {% trans "Registrations" %} <i class="fa fa-user-plus"></i> {% trans "Registrations" %}
</a> </a>
{% endif %} {% endif %}

View File

@ -13,7 +13,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
</h3> </h3>
<div class="card-body"> <div class="card-body">
<div class="alert alert-info"> <div class="alert alert-info">
<i class="fas fa-info-circle"></i> {% trans "Superusers have all rights on everything, to manage the website." %} <i class="fa fa-info-circle"></i> {% trans "Superusers have all rights on everything, to manage the website." %}
</div> </div>
<div class="card"> <div class="card">
<div class="card-head"> <div class="card-head">

View File

@ -43,14 +43,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% with bde_kfet_fee=club.parent_club.membership_fee_paid|add:club.parent_club.parent_club.membership_fee_paid %} {% with bde_kfet_fee=club.parent_club.membership_fee_paid|add:club.parent_club.parent_club.membership_fee_paid %}
<dt class="col-xl-6">{% trans 'WEI fee (paid students)'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'WEI fee (paid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_paid|add:bde_kfet_fee|pretty_money }} <dd class="col-xl-6">{{ club.membership_fee_paid|add:bde_kfet_fee|pretty_money }}
<i class="fas fa-question-circle" <i class="fa fa-question-circle"
title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd> title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd>
{% endwith %} {% endwith %}
{% with bde_kfet_fee=club.parent_club.membership_fee_unpaid|add:club.parent_club.parent_club.membership_fee_unpaid %} {% with bde_kfet_fee=club.parent_club.membership_fee_unpaid|add:club.parent_club.parent_club.membership_fee_unpaid %}
<dt class="col-xl-6">{% trans 'WEI fee (unpaid students)'|capfirst %}</dt> <dt class="col-xl-6">{% trans 'WEI fee (unpaid students)'|capfirst %}</dt>
<dd class="col-xl-6">{{ club.membership_fee_unpaid|add:bde_kfet_fee|pretty_money }} <dd class="col-xl-6">{{ club.membership_fee_unpaid|add:bde_kfet_fee|pretty_money }}
<i class="fas fa-question-circle" <i class="fa fa-question-circle"
title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd> title="{% trans "The BDE membership is included in the WEI registration." %}"></i></dd>
{% endwith %} {% endwith %}
{% endif %} {% endif %}

View File

@ -5,20 +5,29 @@
if [ -z ${NOTE_URL+x} ]; then if [ -z ${NOTE_URL+x} ]; then
echo "Warning: your env files are not configurated." echo "Warning: your env files are not configurated."
else else
sed -i -e "s/example.com/$DOMAIN/g" /code/apps/member/fixtures/initial.json sed -i -e "s/example.com/$DOMAIN/g" /var/www/note_kfet/apps/member/fixtures/initial.json
sed -i -e "s/localhost/$NOTE_URL/g" /code/note_kfet/fixtures/initial.json sed -i -e "s/localhost/$NOTE_URL/g" /var/www/note_kfet/note_kfet/fixtures/initial.json
sed -i -e "s/\"\.\*\"/\"https?:\/\/$NOTE_URL\/.*\"/g" /code/note_kfet/fixtures/cas.json sed -i -e "s/\"\.\*\"/\"https?:\/\/$NOTE_URL\/.*\"/g" /var/www/note_kfet/note_kfet/fixtures/cas.json
sed -i -e "s/REPLACEME/La Note Kfet \\\\ud83c\\\\udf7b/g" /code/note_kfet/fixtures/cas.json sed -i -e "s/REPLACEME/La Note Kfet \\\\ud83c\\\\udf7b/g" /var/www/note_kfet/note_kfet/fixtures/cas.json
fi fi
python manage.py compilemessages # Set up Django project
python manage.py makemigrations python3 manage.py collectstatic --noinput
python manage.py migrate python3 manage.py compilemessages
python3 manage.py makemigrations
python3 manage.py migrate
nginx if [ "$1" ]; then
# Command passed
if [ "$DJANGO_APP_STAGE" = "prod" ]; then echo "Running $@..."
gunicorn -b 0.0.0.0:8000 --workers=2 --threads=4 --worker-class=gthread note_kfet.wsgi --access-logfile '-' --error-logfile '-'; $@
else else
python manage.py runserver 0.0.0.0:8000; # Launch server
if [ "$DJANGO_APP_STAGE" = "prod" ]; then
uwsgi --http-socket 0.0.0.0:8080 --master --plugins python3 \
--module note_kfet.wsgi:application --env DJANGO_SETTINGS_MODULE=note_kfet.settings \
--processes 4 --static-map /static=/var/www/note_kfet/static --harakiri=20 --max-requests=5000 --vacuum
else
python3 manage.py runserver 0.0.0.0:8080;
fi
fi fi

View File

@ -1,27 +0,0 @@
# This is an example NGINX site configuration for note_kfet in Docker
# Only HTTP, please use a reverse proxy to secure it!
server {
# Serve this site by default on HTTP
listen 80 default_server;
listen [::]:80 default_server;
# Max upload size
client_max_body_size 75M;
# Django statics and media
location /static {
alias /code/static;
}
location /media {
alias /code/media;
}
# Send all non-media requests to the Django server.
location / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
}
}

View File

@ -164,8 +164,10 @@ LANGUAGES = [
STATIC_URL = '/static/' STATIC_URL = '/static/'
# Add some custom statics from /note_kfet/static # Add some custom statics from /note_kfet/static
# Because we are using Debian, also include /usr/share/javascript
STATICFILES_DIRS = [ STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'note_kfet/static'), os.path.join(BASE_DIR, 'note_kfet/static'),
'/usr/share/javascript',
] ]
# Collect statics to /static/ # Collect statics to /static/

View File

@ -24,24 +24,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
{# Bootstrap, Font Awesome and custom CSS #} {# Bootstrap, Font Awesome and custom CSS #}
<link rel="stylesheet" <link rel="stylesheet" href="{% static "bootstrap4/css/bootstrap.min.css" %}">
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" <link rel="stylesheet" href="{% static "font-awesome/css/font-awesome.min.css" %}">
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/all.css">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.13.0/css/v4-shims.css">
<link rel="stylesheet" href="{% static "css/custom.css" %}"> <link rel="stylesheet" href="{% static "css/custom.css" %}">
{# JQuery, Bootstrap and Turbolinks JavaScript #} {# JQuery, Bootstrap and Turbolinks JavaScript #}
<script src="https://code.jquery.com/jquery-3.4.1.min.js" <script src="{% static "jquery/jquery.min.js" %}"></script>
integrity="sha384-vk5WoKIaW/vJyUAd9n/wmopsmNhiy+L2Z+SBxGYnUkunIxVxAv/UtMOhba/xskxh" <script src="{% static "popper.js/umd/popper.min.js" %}"></script>
crossorigin="anonymous"></script> <script src="{% static "bootstrap4/js/bootstrap.min.js" %}"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"
integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js" <script src="https://cdnjs.cloudflare.com/ajax/libs/turbolinks/5.2.0/turbolinks.js"
crossorigin="anonymous"></script> crossorigin="anonymous"></script>
<script src="{% static "js/base.js" %}"></script> <script src="{% static "js/base.js" %}"></script>
@ -69,54 +59,54 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% if "note.transactiontemplate"|not_empty_model_list %} {% if "note.transactiontemplate"|not_empty_model_list %}
<li class="nav-item"> <li class="nav-item">
{% url 'note:consos' as url %} {% url 'note:consos' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-coffee"></i> {% trans 'Consumptions' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-coffee"></i> {% trans 'Consumptions' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if "note.transaction"|not_empty_model_list %} {% if "note.transaction"|not_empty_model_list %}
<li class="nav-item"> <li class="nav-item">
{% url 'note:transfer' as url %} {% url 'note:transfer' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-exchange-alt"></i> {% trans 'Transfer' %} </a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-exchange"></i> {% trans 'Transfer' %} </a>
</li> </li>
{% endif %} {% endif %}
{% if "auth.user"|model_list_length >= 2 %} {% if "auth.user"|model_list_length >= 2 %}
<li class="nav-item"> <li class="nav-item">
{% url 'member:user_list' as url %} {% url 'member:user_list' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-user"></i> {% trans 'Users' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-user"></i> {% trans 'Users' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if "member.club"|not_empty_model_list %} {% if "member.club"|not_empty_model_list %}
<li class="nav-item"> <li class="nav-item">
{% url 'member:club_list' as url %} {% url 'member:club_list' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-users"></i> {% trans 'Clubs' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-users"></i> {% trans 'Clubs' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if "activity.activity"|not_empty_model_list %} {% if "activity.activity"|not_empty_model_list %}
<li class="nav-item"> <li class="nav-item">
{% url 'activity:activity_list' as url %} {% url 'activity:activity_list' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-calendar"></i> {% trans 'Activities' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-calendar"></i> {% trans 'Activities' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if "treasury.invoice"|not_empty_model_list %} {% if "treasury.invoice"|not_empty_model_list %}
<li class="nav-item"> <li class="nav-item">
{% url 'treasury:invoice_list' as url %} {% url 'treasury:invoice_list' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-credit-card"></i> {% trans 'Treasury' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-credit-card"></i> {% trans 'Treasury' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if "wei.weiclub"|not_empty_model_list %} {% if "wei.weiclub"|not_empty_model_list %}
<li class="nav-item"> <li class="nav-item">
{% url 'wei:current_wei_detail' as url %} {% url 'wei:current_wei_detail' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-bus"></i> {% trans 'WEI' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-bus"></i> {% trans 'WEI' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<li class="nav-item"> <li class="nav-item">
{% url 'permission:rights' as url %} {% url 'permission:rights' as url %}
<a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fas fa-balance-scale"></i> {% trans 'Rights' %}</a> <a class="nav-link {% if request.path_info == url %}active{% endif %}" href="{{ url }}"><i class="fa fa-balance-scale"></i> {% trans 'Rights' %}</a>
</li> </li>
{% endif %} {% endif %}
{% if request.user.is_staff and ""|has_perm:user %} {% if request.user.is_staff and ""|has_perm:user %}
<li class="nav-item"> <li class="nav-item">
<a data-turbolinks="false" class="nav-link" href="{% url 'admin:index' %}"><i class="fas fa-user-cog"></i> {% trans 'Admin' %}</a> <a data-turbolinks="false" class="nav-link" href="{% url 'admin:index' %}"><i class="fa fa-cogs"></i> {% trans 'Admin' %}</a>
</li> </li>
{% endif %} {% endif %}
</ul> </ul>
@ -124,16 +114,16 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% if request.user.is_authenticated %} {% if request.user.is_authenticated %}
<li class="dropdown"> <li class="dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user"></i> <i class="fa fa-user"></i>
<span id="user_balance">{{ request.user.username }} ({{ request.user.note.balance | pretty_money }})</span> <span id="user_balance">{{ request.user.username }} ({{ request.user.note.balance | pretty_money }})</span>
</a> </a>
<div class="dropdown-menu dropdown-menu-right" <div class="dropdown-menu dropdown-menu-right"
aria-labelledby="navbarDropdownMenuLink"> aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="{% url 'member:user_detail' pk=request.user.pk %}"> <a class="dropdown-item" href="{% url 'member:user_detail' pk=request.user.pk %}">
<i class="fas fa-user"></i> Mon compte <i class="fa fa-user"></i> Mon compte
</a> </a>
<a class="dropdown-item" href="{% url 'logout' %}"> <a class="dropdown-item" href="{% url 'logout' %}">
<i class="fas fa-sign-out-alt"></i> Se déconnecter <i class="fa fa-sign-out"></i> Se déconnecter
</a> </a>
</div> </div>
</li> </li>
@ -141,14 +131,14 @@ SPDX-License-Identifier: GPL-3.0-or-later
{% if request.path != "/registration/signup/" %} {% if request.path != "/registration/signup/" %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'registration:signup' %}"> <a class="nav-link" href="{% url 'registration:signup' %}">
<i class="fas fa-user-plus"></i> S'inscrire <i class="fa fa-user-plus"></i> S'inscrire
</a> </a>
</li> </li>
{% endif %} {% endif %}
{% if request.path != "/accounts/login/" %} {% if request.path != "/accounts/login/" %}
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="{% url 'login' %}"> <a class="nav-link" href="{% url 'login' %}">
<i class="fas fa-sign-in-alt"></i> Se connecter <i class="fa fa-sign-in"></i> Se connecter
</a> </a>
</li> </li>
{% endif %} {% endif %}

7
requirements.txt Normal file
View File

@ -0,0 +1,7 @@
django-htcpcp-tea==0.3.1
django-mailer==2.0.1
django-phonenumber-field==4.0.0
django-tables2==2.1.0
django-rest-polymorphic==0.1.8
django-bootstrap-datepicker-plus==3.0.5
django-colorfield==0.3.2

View File

@ -1,31 +0,0 @@
beautifulsoup4==4.9.1
certifi==2019.6.16
chardet==3.0.4
defusedxml==0.6.0
Django~=2.2
django-allauth==0.39.1
django-crispy-forms==1.7.2
django-extensions==2.1.9
django-filter==2.2.0
django-htcpcp-tea==0.3.1
django-mailer==2.0.1
django-phonenumber-field==4.0.0
django-polymorphic==2.0.3
django-tables2==2.1.0
docutils==0.14
idna==2.8
lxml==4.5.2
oauthlib==3.1.0
phonenumbers==8.12.7
Pillow==7.1.2
python3-openid==3.1.0
pytz==2019.1
requests==2.22.0
requests-oauthlib==1.2.0
six==1.12.0
sqlparse==0.3.0
djangorestframework==3.9.0
django-rest-polymorphic==0.1.8
urllib3==1.25.3
django-bootstrap-datepicker-plus==3.0.5
django-colorfield==0.3.2

View File

@ -1 +0,0 @@
django-cas-server==1.2.0

View File

@ -1 +0,0 @@
psycopg2-binary==2.8.4

11
tox.ini
View File

@ -10,12 +10,11 @@ envlist =
skipsdist = True skipsdist = True
[testenv] [testenv]
sitepackages = True
setenv = setenv =
PYTHONWARNINGS = all PYTHONWARNINGS = all
deps = deps =
-r{toxinidir}/requirements/base.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/requirements/cas.txt
-r{toxinidir}/requirements/production.txt
coverage coverage
commands = commands =
./manage.py makemigrations ./manage.py makemigrations
@ -24,9 +23,7 @@ commands =
[testenv:linters] [testenv:linters]
deps = deps =
-r{toxinidir}/requirements/base.txt -r{toxinidir}/requirements.txt
-r{toxinidir}/requirements/cas.txt
-r{toxinidir}/requirements/production.txt
flake8 flake8
flake8-colors flake8-colors
flake8-import-order flake8-import-order

View File

@ -1,26 +0,0 @@
uwsgi_param QUERY_STRING $query_string;
uwsgi_param REQUEST_METHOD $request_method;
uwsgi_param CONTENT_TYPE $content_type;
uwsgi_param CONTENT_LENGTH $content_length;
uwsgi_param REQUEST_URI $request_uri;
uwsgi_param PATH_INFO $document_uri;
uwsgi_param DOCUMENT_ROOT $document_root;
uwsgi_param SERVER_PROTOCOL $server_protocol;
uwsgi_param REQUEST_SCHEME $scheme;
uwsgi_param HTTPS $https if_not_empty;
uwsgi_param REMOTE_ADDR $remote_addr;
uwsgi_param REMOTE_PORT $remote_port;
uwsgi_param SERVER_PORT $server_port;
uwsgi_param SERVER_NAME $server_name;