Facilite la saisie, la validation et le suivi de l’agenda des personnes d’une organisation
 
 
 
 
 
Aller au fichier
Antoine b96f6cd333 doc(changelog): publie la version 1.5.1 2022-09-20 21:15:44 +02:00
artwork doc(README): complète et améliore la documentation 2019-08-22 12:09:01 +02:00
assets style(js): documente et clarifie calendar.js 2022-04-29 11:53:51 +02:00
chronos feat(ui): redirige vers Referer à l'envoie des formulaires d'évènements 2022-04-29 11:52:34 +02:00
docs ref(docs): parle plutôt d'actions particulières 2019-03-14 10:09:15 +01:00
requirements ref(base): remplace djchoices par les types énumératifs 2022-02-09 19:42:31 +01:00
styleguide feat(ui): passe à Bootstrap v5.0.0-beta1 2021-01-11 16:19:44 +01:00
.babelrc.json build(assets): mets à jour l'environnement et les dépendances 2022-02-09 10:38:27 +01:00
.browserslistrc feat(assets): mets à jour les navigateurs supportés 2022-02-09 10:38:27 +01:00
.editorconfig build(editorconfig): ajout d'un .editorconfig 2018-10-28 14:40:39 +01:00
.eslintrc.json build(assets): mets à jour l'environnement et les dépendances 2022-02-09 10:38:27 +01:00
.gitignore ref(styleguide): ne garde que l'aperçu des composants 2020-07-28 16:39:06 +02:00
.gitmessage build(Makefile): ajout "reset-migrations" 2018-10-08 11:08:28 +02:00
.prettierrc style(scss): configure prettier et complète les règles 2021-02-25 10:50:50 +01:00
.stylelintrc.json build(assets): mets à jour l'environnement et les dépendances 2022-02-09 10:38:27 +01:00
CHANGELOG.md doc(changelog): publie la version 1.5.1 2022-09-20 21:15:44 +02:00
CONTRIBUTORS.txt initial commit 2018-10-05 13:26:11 +02:00
LICENSE initial commit 2018-10-05 13:26:11 +02:00
Makefile feat(makefile): mets à jour suivant le cookiecutter 2020-12-09 16:36:10 +01:00
README.md doc(readme): spécifie le code et supprime l'install. manuelle 2021-02-23 14:12:55 +01:00
config.env.example feat(evenement): permets de rendre l'action part. requise 2020-08-13 16:48:03 +02:00
manage.py initial commit 2018-10-05 13:26:11 +02:00
package-lock.json build(assets): rafraichis package-lock.json 2022-02-09 15:08:11 +01:00
package.json feat(assets): mets à jour les librairies utilisées 2022-02-09 15:08:11 +01:00
pyproject.toml feat(makefile): mets à jour suivant le cookiecutter 2020-12-09 16:36:10 +01:00
requirements.txt initial commit 2018-10-05 13:26:11 +02:00
setup.cfg ref(base): remplace djchoices par les types énumératifs 2022-02-09 19:42:31 +01:00
webpack.config.js build(assets): mets à jour l'environnement et les dépendances 2022-02-09 10:38:27 +01:00

README.md

Chronos

Chronos est une application Web visant à faciliter la saisie, la validation et le suivi de l'agenda des personnes d'une organisation. Elle est pensée pour s'adapter autant que possible à la composition et la hiérarchie interne de l'organisation.

Table of content

Give a try

On a Debian-based host - running at least Debian Stretch:

$ sudo apt install python3 virtualenv git make
$ git clone https://forge.cliss21.org/cliss21/chronos
$ cd chronos/

$ make init
A configuration will be created interactively; you can uncomment:
 ENV=development

$ make serve

Then visit http://127.0.0.1:8000/ in your web browser.

Installation

Requirements

On a Debian-based host - running at least Debian Stretch, you will need the following packages:

  • python3
  • virtualenv
  • make
  • git (recommended for getting the source)
  • python3-mysqldb (optional, in case of a MySQL / MariaDB database)
  • python3-psycopg2 (optional, in case of a PostgreSQL database)

Quick start

It assumes that you already have the application source code locally - the best way is by cloning this repository - and that you are in this folder.

  1. Define your local configuration in a file named config.env, which can be copied from config.env.example and edited to suits your needs.

    Depending on your environment, you will have to create your database and the user at first.

  2. Run make init.

    Note that if there is no config.env file, it will be created interactively.

That's it! Your environment is now initialized with the application installed. To update it, once the source code is checked out, simply run make update.

You can also check that your application is well configured by running make check.

Deployment

Web application

Here is an example deployment using NGINX - as the Web server - and uWSGI - as the application server.

The uWSGI configuration doesn't require a special configuration, except that we are using Python 3 and a virtual environment. Note that if you serve the application on a sub-location, you will have to add route-run = fixpathinfo: to your uWSGI configuration (from v2.0.11).

In the server block of your NGINX configuration, add the following blocks and set the path to your application instance and to the uWSGI socket:

location / {
    include uwsgi_params;
    uwsgi_pass unix:<uwsgi_socket_path>;
}
location /media {
    alias <app_instance_path>/var/media;
}
location /static {
    alias <app_instance_path>/var/static;
    # Optional: don't log access to assets
    access_log off;
}
location = /favicon.ico {
    alias <app_instance_path>/var/static/favicon/favicon.ico;
    # Optional: don't log access to the favicon
    access_log off;
}

Background jobs

Some tasks need to be done on a regular basis and preferably in background to not impact users requests. As of now, the easiest way to do that is by setting up a cron job in the crontab of the user who is running the application. It can be achieved by executing crontab -e as the user and adding:

# updatecompteurs each monday at 3:30
30 3 * * 1 cd <app_instance_path>; ./venv/bin/python ./manage.py updatecompteurs

Structure

Overview

All the application files - e.g. Django code including settings, templates and statics - are located into the chronos/ directory. It should permit in a near future to distribute the application as a Python package and install it system-wide.

Two environments are defined - either for requirements and settings:

  • development: for local application development and testing. It uses a SQLite3 database and enable debugging by default, add some useful settings and applications for development purpose - i.e. the django-debug-toolbar.
  • production: for production. It checks that configuration is set and correct, try to optimize performances and enforce some settings - i.e. HTTPS related ones.

Local changes

You can override and extend statics and templates locally. This can be useful if you have to change the logo for a specific instance for example. For that, just put your files under the local/static/ and local/templates/ folders.

Regarding the statics, do not forget to collect them after that. Note also that the local/ folder is ignored by git.

Variable content

All the variable content - e.g. user-uploaded media, collected statics - are stored inside the var/ folder. It is also ignored by git as it's specific to each application installation.

So, you will have to configure your Web server to serve the var/media/ and var/static/ folders, which should point to /media/ and /static/, respectively.

Development

The easiest way to deploy a development environment is by using the Makefile.

Before running make init, ensure that you have either set ENV=development in the config.env file or have this environment variable. Note that you can still change this variable later and run make init again.

There is some additional rules when developing, which are mainly wrappers for manage.py. You can list all of them by running make help. Here are the main ones:

  • make serve: run a development server
  • make test: test the whole application
  • make lint: check the Python code syntax

Assets

The assets - e.g. CSS, JavaScript, images, fonts - are generated using a Webpack-powered build system with these features:

  • SCSS compilation and prefixing
  • JavaScript module bundling and code splitting
  • Styleguide and components preview
  • Built-in development server
  • Compression for production builds

The source files live in assets/, and the styleguide in styleguide/.

Requirements

All you need is npm. It is included in Debian since Buster and also in the stretch-backports repository.

Usage

Start by installing or updating the application dependencies - which are defined in package.json - by running: npm install.

The following tasks are then available:

  • npm run build: build all the assets for development and production use, and put them in the static folder - e.g chronos/static.
  • npm run dev: run a proxy server to the app - which must already be served on localhost:8000 - with the styleguide on /styleguide and watch for file changes.
  • npm run lint: lint the JavaScript and the SCSS code.

In production, only the static files will be used. It is recommended to commit the compiled assets just before a new release only. This will prevent to have a growing repository due to the minified files.

License

Chronos is developed by Cliss XXI and licensed under the AGPLv3+.