From ddaf5e82bd5ddb449747be336f5ce640db14ccf3 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Wed, 20 Jan 2021 15:00:26 +0100 Subject: [PATCH] Prepare documentation on /doc --- Dockerfile | 7 ++++- docs/Makefile | 20 +++++++++++++++ docs/conf.py | 60 +++++++++++++++++++++++++++++++++++++++++++ docs/index.rst | 23 +++++++++++++++++ docs/requirements.txt | 2 ++ nginx_tfjm.conf | 5 ++++ 6 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 docs/Makefile create mode 100644 docs/conf.py create mode 100644 docs/index.rst create mode 100644 docs/requirements.txt diff --git a/Dockerfile b/Dockerfile index 913576f..0065ffa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,13 +8,18 @@ RUN apk add --no-cache gettext nginx gcc libc-dev libffi-dev libxml2-dev libxslt RUN apk add --no-cache bash -RUN mkdir /code +RUN mkdir /code /code/docs WORKDIR /code COPY requirements.txt /code/requirements.txt +COPY docs/requirements.txt /code/docs/requirements.txt RUN pip install -r requirements.txt --no-cache-dir +RUN pip install -r docs/requirements.txt --no-cache-dir COPY . /code/ +# Compile documentation +RUN sphinx-build -M html docs docs/_build + RUN python manage.py collectstatic --noinput && \ python manage.py compilemessages diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/docs/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..128ec7f --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,60 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'Plateforme du TFJM²' +copyright = "2020-2021" +author = "Animath" + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + "sphinx_rtd_theme", +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = 'fr' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build'] + + +# -- Options for HTML output ------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..215e312 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,23 @@ +Documentation de la plateforme du TFJM² +======================================= + +.. image:: https://gitlab.com/animath/si/plateforme-tfjm/badges/master/pipeline.svg + :target: https://gitlab.com/animath/si/plateforme-tfjm/-/commits/master + :alt: Pipeline status + +.. image:: https://gitlab.com/animath/si/plateforme-tfjm/badges/master/coverage.svg + :target: https://gitlab.com/animath/si/plateforme-tfjm/-/commits/master + :alt: Coverage report + +.. image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg + :target: https://www.gnu.org/licenses/gpl-3.0.txt + :alt: License: GPL v3 + + +.. toctree:: + :maxdepth: 3 + :caption: Développer + +.. toctree:: + :maxdepth: 3 + :caption: Jouer diff --git a/docs/requirements.txt b/docs/requirements.txt new file mode 100644 index 0000000..540deda --- /dev/null +++ b/docs/requirements.txt @@ -0,0 +1,2 @@ +sphinx>=3.3 +sphinx-rtd-theme>=0.5 diff --git a/nginx_tfjm.conf b/nginx_tfjm.conf index 5e3687a..3fa0e6b 100644 --- a/nginx_tfjm.conf +++ b/nginx_tfjm.conf @@ -5,6 +5,7 @@ upstream tfjm { server { listen 80; server_name tfjm; + charset utf-8; client_max_body_size 50M; location / { @@ -17,4 +18,8 @@ server { location /static { alias /code/static/; } + + location /doc { + alias /code/docs/_build/html/; + } }