bifurqué depuis cliss21/chronos
initial commit
révision
03ea124eae
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"presets": [ "@babel/preset-env" ]
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
# Browsers that we support
|
||||
# see: https://github.com/browserslist/browserslist#readme
|
||||
|
||||
>= 1%
|
||||
last 1 major version
|
||||
not dead
|
||||
Chrome >= 45
|
||||
Firefox >= 38
|
||||
Edge >= 12
|
||||
Explorer >= 10
|
||||
iOS >= 9
|
||||
Safari >= 9
|
||||
Android >= 4.4
|
||||
Opera >= 30
|
|
@ -0,0 +1,239 @@
|
|||
{
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es6": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"impliedStrict": true,
|
||||
"jsx": false
|
||||
},
|
||||
"ecmaVersion": 6,
|
||||
"sourceType": "module"
|
||||
},
|
||||
"extends": ["eslint:recommended"],
|
||||
"rules": {
|
||||
// Possible Errors
|
||||
"no-await-in-loop": "error",
|
||||
"no-extra-parens": "error",
|
||||
"no-prototype-builtins": "error",
|
||||
"no-template-curly-in-string": "error",
|
||||
"valid-jsdoc": "error",
|
||||
|
||||
// Best Practices
|
||||
"accessor-pairs": "error",
|
||||
"array-callback-return": "error",
|
||||
"block-scoped-var": "error",
|
||||
"class-methods-use-this": "off",
|
||||
"complexity": "error",
|
||||
"consistent-return": "error",
|
||||
"curly": "error",
|
||||
"default-case": "error",
|
||||
"dot-location": ["error", "property"],
|
||||
"dot-notation": "error",
|
||||
"eqeqeq": "error",
|
||||
"guard-for-in": "error",
|
||||
"no-alert": "error",
|
||||
"no-caller": "error",
|
||||
"no-div-regex": "error",
|
||||
"no-else-return": "error",
|
||||
"no-empty-function": "error",
|
||||
"no-eq-null": "error",
|
||||
"no-eval": "error",
|
||||
"no-extend-native": "error",
|
||||
"no-extra-bind": "error",
|
||||
"no-extra-label": "error",
|
||||
"no-floating-decimal": "error",
|
||||
"no-implicit-coercion": "error",
|
||||
"no-implicit-globals": "error",
|
||||
"no-implied-eval": "error",
|
||||
"no-invalid-this": "off",
|
||||
"no-iterator": "error",
|
||||
"no-labels": "error",
|
||||
"no-lone-blocks": "error",
|
||||
"no-loop-func": "error",
|
||||
"no-magic-numbers": ["error", {
|
||||
"ignore": [-1, 0, 1],
|
||||
"ignoreArrayIndexes": true
|
||||
}
|
||||
],
|
||||
"no-multi-spaces": ["error", {
|
||||
"ignoreEOLComments": true,
|
||||
"exceptions": {
|
||||
"AssignmentExpression": true,
|
||||
"ArrowFunctionExpression": true,
|
||||
"CallExpression": true,
|
||||
"VariableDeclarator": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"no-multi-str": "error",
|
||||
"no-new": "error",
|
||||
"no-new-func": "error",
|
||||
"no-new-wrappers": "error",
|
||||
"no-octal-escape": "error",
|
||||
"no-param-reassign": "off",
|
||||
"no-proto": "error",
|
||||
"no-restricted-properties": "error",
|
||||
"no-return-assign": "error",
|
||||
"no-return-await": "error",
|
||||
"no-script-url": "error",
|
||||
"no-self-compare": "error",
|
||||
"no-sequences": "error",
|
||||
"no-throw-literal": "error",
|
||||
"no-unmodified-loop-condition": "error",
|
||||
"no-unused-expressions": "error",
|
||||
"no-useless-call": "error",
|
||||
"no-useless-concat": "error",
|
||||
"no-useless-return": "error",
|
||||
"no-void": "error",
|
||||
"no-warning-comments": "off",
|
||||
"no-with": "error",
|
||||
"prefer-promise-reject-errors": "error",
|
||||
"radix": "error",
|
||||
"require-await": "error",
|
||||
"vars-on-top": "error",
|
||||
"wrap-iife": "error",
|
||||
"yoda": "error",
|
||||
|
||||
// Strict Mode
|
||||
"strict": "error",
|
||||
|
||||
// Variables
|
||||
"init-declarations": "off",
|
||||
"no-catch-shadow": "error",
|
||||
"no-label-var": "error",
|
||||
"no-restricted-globals": "error",
|
||||
"no-shadow": "off",
|
||||
"no-shadow-restricted-names": "error",
|
||||
"no-undef-init": "error",
|
||||
"no-undefined": "error",
|
||||
"no-use-before-define": "off",
|
||||
|
||||
// Node.js and CommonJS
|
||||
"callback-return": "off",
|
||||
"global-require": "error",
|
||||
"handle-callback-err": "error",
|
||||
"no-mixed-requires": "error",
|
||||
"no-new-require": "error",
|
||||
"no-path-concat": "error",
|
||||
"no-process-env": "error",
|
||||
"no-process-exit": "error",
|
||||
"no-restricted-modules": "error",
|
||||
"no-sync": "error",
|
||||
|
||||
// Stylistic Issues
|
||||
"array-bracket-spacing": "error",
|
||||
"block-spacing": "error",
|
||||
"brace-style": "error",
|
||||
"camelcase": "error",
|
||||
"capitalized-comments": "off",
|
||||
"comma-dangle": "error",
|
||||
"comma-spacing": "error",
|
||||
"comma-style": "error",
|
||||
"computed-property-spacing": "error",
|
||||
"consistent-this": "error",
|
||||
"eol-last": "error",
|
||||
"func-call-spacing": "error",
|
||||
"func-name-matching": "error",
|
||||
"func-names": "off",
|
||||
"func-style": ["error", "declaration"],
|
||||
"id-blacklist": "error",
|
||||
"id-length": "off",
|
||||
"id-match": "error",
|
||||
"indent": ["error", 2, { "SwitchCase": 1 }],
|
||||
"jsx-quotes": "error",
|
||||
"key-spacing": "off",
|
||||
"keyword-spacing": "error",
|
||||
"linebreak-style": ["error", "unix"],
|
||||
"line-comment-position": "off",
|
||||
"lines-around-comment": "off",
|
||||
"lines-around-directive": "error",
|
||||
"max-depth": ["error", 10],
|
||||
"max-len": "off",
|
||||
"max-lines": "off",
|
||||
"max-nested-callbacks": "error",
|
||||
"max-params": "off",
|
||||
"max-statements": "off",
|
||||
"max-statements-per-line": "error",
|
||||
"multiline-ternary": "off",
|
||||
"new-cap": ["error", { "capIsNewExceptionPattern": "$.*" }],
|
||||
"newline-after-var": "off",
|
||||
"newline-per-chained-call": ["error", { "ignoreChainWithDepth": 5 }],
|
||||
"new-parens": "error",
|
||||
"no-array-constructor": "error",
|
||||
"no-bitwise": "error",
|
||||
"no-continue": "off",
|
||||
"no-inline-comments": "off",
|
||||
"no-lonely-if": "error",
|
||||
"no-mixed-operators": "off",
|
||||
"no-multi-assign": "error",
|
||||
"no-multiple-empty-lines": "error",
|
||||
"nonblock-statement-body-position": "error",
|
||||
"no-negated-condition": "off",
|
||||
"no-nested-ternary": "error",
|
||||
"no-new-object": "error",
|
||||
"no-plusplus": "off",
|
||||
"no-restricted-syntax": "error",
|
||||
"no-tabs": "error",
|
||||
"no-ternary": "off",
|
||||
"no-trailing-spaces": "error",
|
||||
"no-underscore-dangle": "off",
|
||||
"no-unneeded-ternary": "error",
|
||||
"no-whitespace-before-property": "error",
|
||||
"object-curly-newline": ["error", { "minProperties": 1 }],
|
||||
"object-curly-spacing": ["error", "always"],
|
||||
"object-property-newline": "error",
|
||||
"one-var": ["error", "never"],
|
||||
"one-var-declaration-per-line": "error",
|
||||
"operator-assignment": "error",
|
||||
"operator-linebreak": "error",
|
||||
"padded-blocks": ["error", "never"],
|
||||
"padding-line-between-statements": "off",
|
||||
"quote-props": ["error", "as-needed"],
|
||||
"quotes": ["error", "single"],
|
||||
"require-jsdoc": "off",
|
||||
"semi": ["error", "always"],
|
||||
"semi-spacing": "error",
|
||||
"sort-keys": "off",
|
||||
"sort-vars": "error",
|
||||
"space-before-blocks": "error",
|
||||
"space-before-function-paren": ["error", {
|
||||
"anonymous": "always",
|
||||
"named": "never"
|
||||
}],
|
||||
"space-in-parens": "error",
|
||||
"space-infix-ops": "error",
|
||||
"space-unary-ops": "error",
|
||||
"spaced-comment": "error",
|
||||
"template-tag-spacing": "error",
|
||||
"unicode-bom": "error",
|
||||
"wrap-regex": "off",
|
||||
|
||||
// ECMAScript 6
|
||||
"arrow-body-style": ["error", "as-needed"],
|
||||
"arrow-parens": "error",
|
||||
"arrow-spacing": "error",
|
||||
"generator-star-spacing": "error",
|
||||
"no-confusing-arrow": "error",
|
||||
"no-duplicate-imports": "error",
|
||||
"no-restricted-imports": "error",
|
||||
"no-useless-computed-key": "error",
|
||||
"no-useless-constructor": "error",
|
||||
"no-useless-rename": "error",
|
||||
"no-var": "error",
|
||||
"object-shorthand": "error",
|
||||
"prefer-arrow-callback": "error",
|
||||
"prefer-const": "error",
|
||||
"prefer-destructuring": "off",
|
||||
"prefer-numeric-literals": "error",
|
||||
"prefer-rest-params": "error",
|
||||
"prefer-spread": "error",
|
||||
"prefer-template": "error",
|
||||
"rest-spread-spacing": "error",
|
||||
"sort-imports": "error",
|
||||
"symbol-description": "error",
|
||||
"template-curly-spacing": "error",
|
||||
"yield-star-spacing": "error"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
# Editors
|
||||
*~
|
||||
*.sw[po]
|
||||
|
||||
# Python
|
||||
*.py[cod]
|
||||
__pycache__
|
||||
|
||||
# Virtual environment
|
||||
.env
|
||||
venv
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
pip-log.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
.coverage
|
||||
.tox
|
||||
nosetests.xml
|
||||
htmlcov
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# NPM
|
||||
node_modules/
|
||||
|
||||
# Databases
|
||||
sqlite.db
|
||||
|
||||
# Local configuration
|
||||
config.env
|
||||
|
||||
# Local overrides and variable content
|
||||
local/
|
||||
var/
|
|
@ -0,0 +1,276 @@
|
|||
{
|
||||
"extends": ["stylelint-config-standard", "stylelint-config-recommended-scss"],
|
||||
"plugins": [
|
||||
"stylelint-order"
|
||||
],
|
||||
"rules": {
|
||||
"at-rule-empty-line-before": null,
|
||||
"at-rule-name-space-after": "always",
|
||||
"at-rule-no-vendor-prefix": true,
|
||||
"at-rule-semicolon-space-before": "never",
|
||||
"block-closing-brace-empty-line-before": null,
|
||||
"block-closing-brace-newline-after": null,
|
||||
"block-opening-brace-space-before": null,
|
||||
"color-named": "never",
|
||||
"declaration-block-semicolon-newline-after": "always-multi-line",
|
||||
"declaration-block-semicolon-newline-before": "never-multi-line",
|
||||
"declaration-block-semicolon-space-after": "always-single-line",
|
||||
"declaration-empty-line-before": null,
|
||||
"declaration-no-important": true,
|
||||
"font-family-name-quotes": "always-where-recommended",
|
||||
"font-weight-notation": [
|
||||
"numeric", {
|
||||
"ignore": ["relative"]
|
||||
}],
|
||||
"function-url-no-scheme-relative": true,
|
||||
"function-url-quotes": "always",
|
||||
"length-zero-no-unit": true,
|
||||
"max-empty-lines": 2,
|
||||
"max-line-length": null,
|
||||
"media-feature-name-no-vendor-prefix": true,
|
||||
"media-feature-parentheses-space-inside": "never",
|
||||
"media-feature-range-operator-space-after": "always",
|
||||
"media-feature-range-operator-space-before": "never",
|
||||
"no-descending-specificity": null,
|
||||
"no-duplicate-selectors": true,
|
||||
"number-leading-zero": "never",
|
||||
"media-feature-name-no-unknown": [true, {
|
||||
"ignoreMediaFeatureNames": ["prefers-reduced-motion"]
|
||||
}],
|
||||
"order/properties-order": [
|
||||
"position",
|
||||
"top",
|
||||
"right",
|
||||
"bottom",
|
||||
"left",
|
||||
"z-index",
|
||||
"box-sizing",
|
||||
"display",
|
||||
"flex",
|
||||
"flex-align",
|
||||
"flex-basis",
|
||||
"flex-direction",
|
||||
"flex-wrap",
|
||||
"flex-flow",
|
||||
"flex-shrink",
|
||||
"flex-grow",
|
||||
"flex-order",
|
||||
"flex-pack",
|
||||
"align-content",
|
||||
"align-items",
|
||||
"align-self",
|
||||
"justify-content",
|
||||
"order",
|
||||
"float",
|
||||
"width",
|
||||
"min-width",
|
||||
"max-width",
|
||||
"height",
|
||||
"min-height",
|
||||
"max-height",
|
||||
"padding",
|
||||
"padding-top",
|
||||
"padding-right",
|
||||
"padding-bottom",
|
||||
"padding-left",
|
||||
"margin",
|
||||
"margin-top",
|
||||
"margin-right",
|
||||
"margin-bottom",
|
||||
"margin-left",
|
||||
"overflow",
|
||||
"overflow-x",
|
||||
"overflow-y",
|
||||
"-webkit-overflow-scrolling",
|
||||
"-ms-overflow-x",
|
||||
"-ms-overflow-y",
|
||||
"-ms-overflow-style",
|
||||
"columns",
|
||||
"column-count",
|
||||
"column-fill",
|
||||
"column-gap",
|
||||
"column-rule",
|
||||
"column-rule-width",
|
||||
"column-rule-style",
|
||||
"column-rule-color",
|
||||
"column-span",
|
||||
"column-width",
|
||||
"orphans",
|
||||
"widows",
|
||||
"clip",
|
||||
"clear",
|
||||
"font",
|
||||
"font-family",
|
||||
"font-size",
|
||||
"font-style",
|
||||
"font-weight",
|
||||
"font-variant",
|
||||
"font-size-adjust",
|
||||
"font-stretch",
|
||||
"font-effect",
|
||||
"font-emphasize",
|
||||
"font-emphasize-position",
|
||||
"font-emphasize-style",
|
||||
"font-smooth",
|
||||
"src",
|
||||
"hyphens",
|
||||
"line-height",
|
||||
"color",
|
||||
"text-align",
|
||||
"text-align-last",
|
||||
"text-emphasis",
|
||||
"text-emphasis-color",
|
||||
"text-emphasis-style",
|
||||
"text-emphasis-position",
|
||||
"text-decoration",
|
||||
"text-indent",
|
||||
"text-justify",
|
||||
"text-outline",
|
||||
"-ms-text-overflow",
|
||||
"text-overflow",
|
||||
"text-overflow-ellipsis",
|
||||
"text-overflow-mode",
|
||||
"text-shadow",
|
||||
"text-transform",
|
||||
"text-wrap",
|
||||
"-webkit-text-size-adjust",
|
||||
"-ms-text-size-adjust",
|
||||
"letter-spacing",
|
||||
"-ms-word-break",
|
||||
"word-break",
|
||||
"word-spacing",
|
||||
"-ms-word-wrap",
|
||||
"word-wrap",
|
||||
"overflow-wrap",
|
||||
"tab-size",
|
||||
"white-space",
|
||||
"vertical-align",
|
||||
"direction",
|
||||
"unicode-bidi",
|
||||
"list-style",
|
||||
"list-style-position",
|
||||
"list-style-type",
|
||||
"list-style-image",
|
||||
"pointer-events",
|
||||
"-ms-touch-action",
|
||||
"touch-action",
|
||||
"cursor",
|
||||
"visibility",
|
||||
"zoom",
|
||||
"table-layout",
|
||||
"empty-cells",
|
||||
"caption-side",
|
||||
"border-spacing",
|
||||
"border-collapse",
|
||||
"content",
|
||||
"quotes",
|
||||
"counter-reset",
|
||||
"counter-increment",
|
||||
"resize",
|
||||
"user-select",
|
||||
"nav-index",
|
||||
"nav-up",
|
||||
"nav-right",
|
||||
"nav-down",
|
||||
"nav-left",
|
||||
"background",
|
||||
"background-color",
|
||||
"background-image",
|
||||
"filter",
|
||||
"background-repeat",
|
||||
"background-attachment",
|
||||
"background-position",
|
||||
"background-position-x",
|
||||
"background-position-y",
|
||||
"background-clip",
|
||||
"background-origin",
|
||||
"background-size",
|
||||
"border",
|
||||
"border-color",
|
||||
"border-style",
|
||||
"border-width",
|
||||
"border-top",
|
||||
"border-top-color",
|
||||
"border-top-style",
|
||||
"border-top-width",
|
||||
"border-right",
|
||||
"border-right-color",
|
||||
"border-right-style",
|
||||
"border-right-width",
|
||||
"border-bottom",
|
||||
"border-bottom-color",
|
||||
"border-bottom-style",
|
||||
"border-bottom-width",
|
||||
"border-left",
|
||||
"border-left-color",
|
||||
"border-left-style",
|
||||
"border-left-width",
|
||||
"border-radius",
|
||||
"border-top-left-radius",
|
||||
"border-top-right-radius",
|
||||
"border-bottom-right-radius",
|
||||
"border-bottom-left-radius",
|
||||
"border-image",
|
||||
"border-image-source",
|
||||
"border-image-slice",
|
||||
"border-image-width",
|
||||
"border-image-outset",
|
||||
"border-image-repeat",
|
||||
"outline",
|
||||
"outline-width",
|
||||
"outline-style",
|
||||
"outline-color",
|
||||
"outline-offset",
|
||||
"box-shadow",
|
||||
"opacity",
|
||||
"-ms-interpolation-mode",
|
||||
"page-break-after",
|
||||
"page-break-before",
|
||||
"page-break-inside",
|
||||
"transition",
|
||||
"transition-delay",
|
||||
"transition-timing-function",
|
||||
"transition-duration",
|
||||
"transition-property",
|
||||
"transform",
|
||||
"transform-origin",
|
||||
"perspective",
|
||||
"appearance",
|
||||
"animation",
|
||||
"animation-name",
|
||||
"animation-duration",
|
||||
"animation-play-state",
|
||||
"animation-timing-function",
|
||||
"animation-delay",
|
||||
"animation-iteration-count",
|
||||
"animation-direction",
|
||||
"animation-fill-mode",
|
||||
"fill",
|
||||
"stroke"
|
||||
],
|
||||
"property-no-vendor-prefix": true,
|
||||
"rule-empty-line-before": null,
|
||||
"selector-attribute-quotes": "always",
|
||||
"selector-list-comma-newline-after": "always",
|
||||
"selector-list-comma-newline-before": "never-multi-line",
|
||||
"selector-list-comma-space-after": "always-single-line",
|
||||
"selector-list-comma-space-before": "never-single-line",
|
||||
"selector-max-attribute": 2,
|
||||
"selector-max-class": 4,
|
||||
"selector-max-combinators": 4,
|
||||
"selector-max-compound-selectors": 4,
|
||||
"selector-max-empty-lines": 1,
|
||||
"selector-max-id": 0,
|
||||
"selector-max-specificity": null,
|
||||
"selector-max-type": 2,
|
||||
"selector-max-universal": 1,
|
||||
"selector-no-qualifying-type": true,
|
||||
"selector-no-vendor-prefix": true,
|
||||
"string-quotes": "double",
|
||||
"value-keyword-case": "lower",
|
||||
"value-list-comma-newline-after": "never-multi-line",
|
||||
"value-list-comma-newline-before": "never-multi-line",
|
||||
"value-list-comma-space-after": "always",
|
||||
"value-no-vendor-prefix": true
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
# Changelog
|
||||
All notable changes to Chronos will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## [Unreleased]
|
||||
### Added
|
|
@ -0,0 +1 @@
|
|||
This software is developped by Cliss XXI.
|
Fichier diff supprimé car celui-ci est trop grand
Voir la Diff
|
@ -0,0 +1,142 @@
|
|||
# -*- mode: makefile-gmake -*-
|
||||
## Définition des variables
|
||||
# Le nom de l'exécutable Python à utiliser ou son chemin absolu
|
||||
# (ex. : python ou python3).
|
||||
PYTHON_EXE := python3
|
||||
# S'il faut utiliser un environnement virtuel (y ou n).
|
||||
USE_VENV := y
|
||||
# Configuration de l'environnement virtuel.
|
||||
VENV_DIR := venv
|
||||
VENV_OPT := --system-site-packages
|
||||
|
||||
# Définis les chemins et options des exécutables.
|
||||
PYTHON_EXE_BASENAME := $(shell basename $(PYTHON_EXE))
|
||||
VENV_PYTHON := --python=$(PYTHON_EXE_BASENAME)
|
||||
ifeq ($(USE_VENV), y)
|
||||
PYTHON := $(VENV_DIR)/bin/$(PYTHON_EXE_BASENAME)
|
||||
PIP := $(VENV_DIR)/bin/pip
|
||||
else
|
||||
PYTHON := $(shell which $(PYTHON_EXE))
|
||||
PIP := $(shell which pip)
|
||||
endif
|
||||
|
||||
# Détermine s'il faut charger le fichier de configuration.
|
||||
ifneq ($(READ_CONFIG_FILE), 0)
|
||||
READ_CONFIG_FILE := 1
|
||||
else
|
||||
READ_CONFIG_FILE := 0
|
||||
endif
|
||||
|
||||
# Détermine l'environnement à utiliser.
|
||||
DEFAULT_ENV := production
|
||||
ifndef ENV
|
||||
ifeq ($(READ_CONFIG_FILE), 1)
|
||||
# Commence par chercher la dernière valeur de DJANGO_SETTINGS_MODULE,
|
||||
# puis de ENV s'il n'y en a pas, ou utilise l'environnement par défaut.
|
||||
ENV = $(shell \
|
||||
sed -n -e '/^DJANGO_SETTINGS_MODULE/s/[^.]*\.settings\.\([^.]*\)/\1/p' \
|
||||
-e '/^ENV/s/[^=]*=\(.*\)/\1/p' config.env 2> /dev/null \
|
||||
| tail -n 1 | grep -Ee '^..*' || echo "$(DEFAULT_ENV)")
|
||||
else
|
||||
ifdef DJANGO_SETTINGS_MODULE
|
||||
ENV = $(shell echo $(DJANGO_SETTINGS_MODULE) | cut -d. -f3)
|
||||
else
|
||||
ENV := $(DEFAULT_ENV)
|
||||
endif # ifdef DJANGO_SETTINGS_MODULE
|
||||
endif # ifeq READ_CONFIG_FILE
|
||||
endif # ifndef ENV
|
||||
|
||||
# Définis EDITOR pour l'édition interactive.
|
||||
ifndef EDITOR
|
||||
ifdef VISUAL
|
||||
EDITOR := $(VISUAL)
|
||||
else
|
||||
EDITOR := vi
|
||||
endif
|
||||
endif
|
||||
|
||||
# Définition des cibles -------------------------------------------------------
|
||||
|
||||
.PHONY: clean-pyc clean-build clear-venv help check check-config
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
# Commentaire d'une cible : #-> interne ##-> aide production+dev ###-> aide dev
|
||||
help: ## affiche cette aide
|
||||
ifeq ($(ENV), production)
|
||||
@perl -nle'print $& if m{^[a-zA-Z_-]+:[^#]*?## .*$$}' $(MAKEFILE_LIST) \
|
||||
| sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
|
||||
else
|
||||
@perl -nle'print $& if m{^[a-zA-Z_-]+:[^#]*?###? .*$$}' $(MAKEFILE_LIST) \
|
||||
| sort | awk 'BEGIN {FS = ":.*?###? "}; {printf "\033[36m%-15s\033[0m %s\n", $$1, $$2}'
|
||||
endif
|
||||
|
||||
clean: clean-build clean-pyc ## nettoie tous les fichiers temporaires
|
||||
|
||||
clean-build: ### nettoie les fichiers de construction du paquet
|
||||
rm -rf build/
|
||||
rm -rf dist/
|
||||
rm -rf *.egg-info
|
||||
|
||||
clean-pyc: ### nettoie les fichiers temporaires python
|
||||
find . -name '*.pyc' -exec rm -f {} +
|
||||
find . -name '*.pyo' -exec rm -f {} +
|
||||
find . -name '*~' -exec rm -f {} +
|
||||
|
||||
init: create-venv config.env update ## initialise l'environnement et l'application
|
||||
|
||||
config.env:
|
||||
ifeq ($(READ_CONFIG_FILE), 1)
|
||||
cp config.env.example config.env
|
||||
chmod go-rwx config.env
|
||||
$(EDITOR) config.env
|
||||
endif
|
||||
|
||||
update: check-config install-deps migrate static ## mets à jour l'application et ses dépendances
|
||||
touch chronos/wsgi.py
|
||||
|
||||
check: check-config ## vérifie la configuration de l'instance
|
||||
$(PYTHON) manage.py check
|
||||
|
||||
check-config:
|
||||
@find . -maxdepth 1 -name config.env -perm /o+rwx -exec false {} + || \
|
||||
{ echo "\033[31mErreur :\033[0m les permissions de config.env ne sont pas bonnes, \
|
||||
vous devriez au moins faire : chmod o-rwx config.env"; false; }
|
||||
|
||||
install-deps: ## installe les dépendances de l'application
|
||||
$(PIP) install -r requirements/$(ENV).txt
|
||||
|
||||
migrate: ## mets à jour le schéma de la base de données
|
||||
$(PYTHON) manage.py migrate
|
||||
|
||||
static: ## collecte les fichiers statiques
|
||||
ifeq ($(ENV), production)
|
||||
@echo "Collecte des fichiers statiques..."
|
||||
$(PYTHON) manage.py collectstatic --no-input --verbosity 0
|
||||
endif
|
||||
|
||||
## Cibles liées à l'environnement virtuel
|
||||
|
||||
create-venv: $(PYTHON)
|
||||
|
||||
$(PYTHON):
|
||||
ifeq ($(USE_VENV), y)
|
||||
virtualenv $(VENV_OPT) $(VENV_PYTHON) $(VENV_DIR)
|
||||
else
|
||||
@echo "\033[31mErreur !\033[0m Impossible de trouver l'exécutable Python $(PYTHON)"
|
||||
@exit 1
|
||||
endif
|
||||
|
||||
clear-venv: ## supprime l'environnement virtuel
|
||||
-rm -rf $(VENV_DIR)
|
||||
|
||||
## Cibles pour le développement
|
||||
|
||||
test: ### lance les tests de l'application
|
||||
DJANGO_SETTINGS_MODULE="chronos.settings.test" \
|
||||
$(PYTHON) manage.py test --parallel 4
|
||||
|
||||
serve: ### démarre un serveur local pour l'application
|
||||
$(PYTHON) manage.py runserver
|
||||
|
||||
lint: ### vérifie la syntaxe et le code python
|
||||
flake8 chronos
|
|
@ -0,0 +1,155 @@
|
|||
# Chronos
|
||||
|
||||
gestion et organisation du temps
|
||||
|
||||
## Installation
|
||||
### Requirements
|
||||
|
||||
On a Debian-based host - running at least Debian Stretch, you will need the
|
||||
following packages:
|
||||
- python3
|
||||
- virtualenv
|
||||
- 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`.
|
||||
|
||||
### Deployment
|
||||
|
||||
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](https://uwsgi-docs.readthedocs.io/en/latest/Changelog-2.0.11.html#fixpathinfo-routing-action)).
|
||||
|
||||
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;
|
||||
}
|
||||
```
|
||||
|
||||
You should also check that your application is well configured by running
|
||||
`make check`.
|
||||
|
||||
### Manual installation
|
||||
|
||||
If you don't want to use the `Makefile` facilities, here is what is done behind the scene.
|
||||
|
||||
It assumes that you have downloaded the last release of Chronos,
|
||||
extracted it and that you moved to that folder.
|
||||
|
||||
1. Start by creating a new virtual environment under `./venv` and activate it:
|
||||
|
||||
$ virtualenv --system-site-packages ./venv
|
||||
$ source ./venv/bin/activate
|
||||
|
||||
2. Install the required Python packages depending on your environment:
|
||||
|
||||
$ pip install -r requirements/production.txt
|
||||
... or ...
|
||||
$ pip install -r requirements/development.txt
|
||||
|
||||
3. Configure the application by setting the proper environment variables
|
||||
depending on your environment. You can use the `config.env.example` which
|
||||
give you the main variables with example values.
|
||||
|
||||
$ cp config.env.example config.env
|
||||
$ nano config.env
|
||||
$ chmod go-rwx config.env
|
||||
|
||||
Note that this `./config.env` file will be loaded by default when the
|
||||
application starts. If you don't want that, just move this file away or set
|
||||
the `READ_CONFIG_FILE` environment variable to `0`.
|
||||
|
||||
4. Create the database tables - it assumes that you have created the database
|
||||
and set the proper configuration to use it:
|
||||
|
||||
$ ./manage.py migrate
|
||||
|
||||
That's it! You should now be able to start the Django development server to
|
||||
check that everything is working fine with:
|
||||
|
||||
$ ./manage.py runserver
|
||||
|
||||
## Structure
|
||||
### Overview
|
||||
|
||||
All the application files - e.g. Django code including settings, templates and
|
||||
statics - are located into the `chronos/`. 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
|
||||
|
||||
## License
|
||||
|
||||
Chronos is developed by Cliss XXI and licensed under the
|
||||
[AGPLv3+](LICENSE).
|
|
@ -0,0 +1,15 @@
|
|||
import './lib/bootstrap';
|
||||
import $ from 'jquery';
|
||||
|
||||
// Export jQuery for external usage
|
||||
window.$ = $;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Main application
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
$(() => {
|
||||
// Initialize Popover and Tooltip on the whole page
|
||||
$('[data-toggle="popover"]').popover();
|
||||
$('[data-toggle="tooltip"]').tooltip();
|
||||
});
|
|
@ -0,0 +1,21 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Bootstrap 4
|
||||
// -----------------------------------------------------------------------------
|
||||
// see: ~bootstrap/js/src/index.js
|
||||
|
||||
// Import all Bootstrap components
|
||||
|
||||
import 'bootstrap';
|
||||
|
||||
// ... or import them individually
|
||||
|
||||
// import 'bootstrap/js/dist/util';
|
||||
// import 'bootstrap/js/dist/alert';
|
||||
// import 'bootstrap/js/dist/carousel';
|
||||
// import 'bootstrap/js/dist/collapse';
|
||||
// import 'bootstrap/js/dist/dropdown';
|
||||
// import 'bootstrap/js/dist/modal';
|
||||
// import 'bootstrap/js/dist/popover';
|
||||
// import 'bootstrap/js/dist/scrollspy';
|
||||
// import 'bootstrap/js/dist/tab';
|
||||
// import 'bootstrap/js/dist/tooltip';
|
|
@ -0,0 +1,4 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Bootstrap's configuration for the application
|
||||
// -----------------------------------------------------------------------------
|
||||
// @link ~bootstrap/scss/_variables.scss
|
|
@ -0,0 +1,8 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Application-wide variables
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// Path to fonts and images folders, relative to css/app.css.
|
||||
/// @type String
|
||||
$font-path: "../fonts";
|
||||
$img-path: "../img";
|
|
@ -0,0 +1,21 @@
|
|||
@charset "utf-8";
|
||||
|
||||
// Configuration and helpers
|
||||
@import "abstracts/variables";
|
||||
@import "abstracts/variables-bootstrap";
|
||||
|
||||
// Vendors
|
||||
@import "vendor/bootstrap";
|
||||
|
||||
// Base styles
|
||||
@import "base/fonts";
|
||||
|
||||
// Layout-related sections
|
||||
//@import "layout/header";
|
||||
//@import "layout/footer";
|
||||
|
||||
// Components
|
||||
@import "components/forms";
|
||||
|
||||
// Page-specific styles
|
||||
//@import "pages/home";
|
|
@ -0,0 +1,3 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Font faces declarations
|
||||
// -----------------------------------------------------------------------------
|
|
@ -0,0 +1,10 @@
|
|||
// -----------------------------------------------------------------------------
|
||||
// Forms component's extension
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
/// Indicate that a form field is required.
|
||||
.required {
|
||||
margin-left: rem-calc(2);
|
||||
font-size: 90%;
|
||||
color: $danger;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
@charset "utf-8";
|
||||
|
||||
// Configuration and helpers
|
||||
@import "abstracts/variables";
|
||||
|
||||
// Fork Awesome
|
||||
// ------------
|
||||
// @link https://forkawesome.github.io/
|
||||
|
||||
$fa-font-path: "#{$font-path}/fork-awesome";
|
||||
|
||||
@import "fork-awesome/scss/fork-awesome";
|
|
@ -0,0 +1,46 @@
|
|||
// ----------------------------------------------------------------------------
|
||||
// Bootstrap 4
|
||||
// ----------------------------------------------------------------------------
|
||||
// see: ~bootstrap/scss/bootstrap.scss
|
||||
|
||||
/// Import all Bootstrap components
|
||||
|
||||
@import "bootstrap/scss/bootstrap";
|
||||
|
||||
/// ... or import them individually
|
||||
|
||||
//@import "bootstrap/scss/functions";
|
||||
//@import "bootstrap/scss/variables";
|
||||
//@import "bootstrap/scss/mixins";
|
||||
//@import "bootstrap/scss/root";
|
||||
//@import "bootstrap/scss/reboot";
|
||||
//@import "bootstrap/scss/type";
|
||||
//@import "bootstrap/scss/images";
|
||||
//@import "bootstrap/scss/code";
|
||||
//@import "bootstrap/scss/grid";
|
||||
//@import "bootstrap/scss/tables";
|
||||
//@import "bootstrap/scss/forms";
|
||||
//@import "bootstrap/scss/buttons";
|
||||
//@import "bootstrap/scss/transitions";
|
||||
//@import "bootstrap/scss/dropdown";
|
||||
//@import "bootstrap/scss/button-group";
|
||||
//@import "bootstrap/scss/input-group";
|
||||
//@import "bootstrap/scss/custom-forms";
|
||||
//@import "bootstrap/scss/nav";
|
||||
//@import "bootstrap/scss/navbar";
|
||||
//@import "bootstrap/scss/card";
|
||||
//@import "bootstrap/scss/breadcrumb";
|
||||
//@import "bootstrap/scss/pagination";
|
||||
//@import "bootstrap/scss/badge";
|
||||
//@import "bootstrap/scss/jumbotron";
|
||||
//@import "bootstrap/scss/alert";
|
||||
//@import "bootstrap/scss/progress";
|
||||
//@import "bootstrap/scss/media";
|
||||
//@import "bootstrap/scss/list-group";
|
||||
//@import "bootstrap/scss/close";
|
||||
//@import "bootstrap/scss/modal";
|
||||
//@import "bootstrap/scss/tooltip";
|
||||
//@import "bootstrap/scss/popover";
|
||||
//@import "bootstrap/scss/carousel";
|
||||
//@import "bootstrap/scss/utilities";
|
||||
//@import "bootstrap/scss/print";
|
|
@ -0,0 +1 @@
|
|||
__version__ = '0.1.0'
|
|
@ -0,0 +1 @@
|
|||
default_app_config = 'chronos.base.apps.BaseConfig'
|
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BaseConfig(AppConfig):
|
||||
name = 'chronos.base'
|
||||
verbose_name = "Base"
|
|
@ -0,0 +1,7 @@
|
|||
from django.urls import path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
urlpatterns = [
|
||||
path('', TemplateView.as_view(template_name='pages/home.html'),
|
||||
name='home'),
|
||||
]
|
|
@ -0,0 +1,22 @@
|
|||
import environ
|
||||
|
||||
"""The default environment to use."""
|
||||
DEFAULT_ENVIRONMENT = 'production'
|
||||
|
||||
"""The environment variables of the app instance."""
|
||||
env = environ.Env()
|
||||
|
||||
"""Path to the package root - e.g. Django project."""
|
||||
root_dir = environ.Path(__file__) - 2
|
||||
|
||||
"""Path to the base directory of the app instance."""
|
||||
base_dir = env.path('BASE_DIR', default=str(root_dir - 1))
|
||||
|
||||
# Load config.env, OS environment variables will take precedence
|
||||
if env.bool('READ_CONFIG_FILE', default=True):
|
||||
env.read_env(str(base_dir.path('config.env')))
|
||||
|
||||
"""The Django settings module's name to use."""
|
||||
DJANGO_SETTINGS_MODULE = env(
|
||||
'DJANGO_SETTINGS_MODULE', default='chronos.settings.{}'.format(env(
|
||||
'ENV', default=DEFAULT_ENVIRONMENT)))
|
|
@ -0,0 +1,235 @@
|
|||
"""
|
||||
Django settings for Chronos project.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/stable/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/stable/ref/settings/
|
||||
"""
|
||||
import os.path
|
||||
|
||||
from . import env, base_dir, root_dir
|
||||
|
||||
# ENVIRONMENT VARIABLES AND PATHS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Local directory used for static and templates overrides
|
||||
local_dir = base_dir.path('local')
|
||||
|
||||
# Directory for variable stuffs, i.e. user-uploaded media
|
||||
var_dir = base_dir.path('var')
|
||||
if not os.path.isdir(var_dir()):
|
||||
os.mkdir(var_dir(), mode=0o755)
|
||||
|
||||
# Location on which the application is served
|
||||
APP_LOCATION = env('APP_LOCATION', default='/')
|
||||
|
||||
# GENERAL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#debug
|
||||
DEBUG = env.bool('DJANGO_DEBUG', default=True)
|
||||
|
||||
# Local time zone for this installation
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#language-code
|
||||
LANGUAGE_CODE = 'fr'
|
||||
|
||||
# https://docs.djangoproject.com/en/dev/ref/settings/#site-id
|
||||
SITE_ID = 1
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#use-i18n
|
||||
USE_I18N = True
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#use-l10n
|
||||
USE_L10N = True
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#use-tz
|
||||
USE_TZ = True
|
||||
|
||||
# DATABASES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#databases
|
||||
# https://django-environ.readthedocs.io/en/stable/#supported-types
|
||||
DATABASES = {
|
||||
'default': env.db('DJANGO_DATABASE_URL', default='sqlite:///{}'.format(
|
||||
base_dir('sqlite.db')
|
||||
)),
|
||||
}
|
||||
|
||||
# URLS
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#root-urlconf
|
||||
ROOT_URLCONF = 'chronos.urls'
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#wsgi-application
|
||||
WSGI_APPLICATION = 'chronos.wsgi.application'
|
||||
|
||||
# APP CONFIGURATION
|
||||
# ------------------------------------------------------------------------------
|
||||
DJANGO_APPS = [
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
]
|
||||
|
||||
# Project dependencies
|
||||
THIRD_PARTY_APPS = []
|
||||
|
||||
# Project applications
|
||||
LOCAL_APPS = [
|
||||
'chronos.base',
|
||||
]
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#installed-apps
|
||||
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS
|
||||
|
||||
# PASSWORDS
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#password-hashers
|
||||
PASSWORD_HASHERS = [
|
||||
# https://docs.djangoproject.com/en/stable/topics/auth/passwords/#using-argon2-with-django
|
||||
# 'django.contrib.auth.hashers.Argon2PasswordHasher',
|
||||
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
||||
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
|
||||
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
|
||||
'django.contrib.auth.hashers.BCryptPasswordHasher',
|
||||
]
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/topics/auth/passwords/#password-validation
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': ('django.contrib.auth.password_validation.'
|
||||
'UserAttributeSimilarityValidator'),
|
||||
},
|
||||
{
|
||||
'NAME': ('django.contrib.auth.password_validation.'
|
||||
'MinimumLengthValidator'),
|
||||
},
|
||||
{
|
||||
'NAME': ('django.contrib.auth.password_validation.'
|
||||
'CommonPasswordValidator'),
|
||||
},
|
||||
{
|
||||
'NAME': ('django.contrib.auth.password_validation.'
|
||||
'NumericPasswordValidator'),
|
||||
},
|
||||
]
|
||||
|
||||
# MIDDLEWARE
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#middleware
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
# STATIC
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#static-files
|
||||
STATIC_ROOT = var_dir('static')
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#static-url
|
||||
STATIC_URL = os.path.join(APP_LOCATION, 'static/')
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#staticfiles-dirs
|
||||
STATICFILES_DIRS = [
|
||||
root_dir('static'),
|
||||
]
|
||||
if os.path.isdir(local_dir('static')):
|
||||
STATICFILES_DIRS.insert(0, local_dir('static'))
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/contrib/staticfiles/#staticfiles-finders
|
||||
STATICFILES_FINDERS = [
|
||||
'django.contrib.staticfiles.finders.FileSystemFinder',
|
||||
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
|
||||
]
|
||||
|
||||
# MEDIA
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#media-root
|
||||
MEDIA_ROOT = var_dir('media')
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#media-url
|
||||
MEDIA_URL = os.path.join(APP_LOCATION, 'media/')
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#file-upload-directory-permissions
|
||||
FILE_UPLOAD_DIRECTORY_PERMISSIONS = 0o755
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#file-upload-permissions
|
||||
FILE_UPLOAD_PERMISSIONS = 0o644
|
||||
|
||||
# TEMPLATES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#templates
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
root_dir('templates'),
|
||||
],
|
||||
'OPTIONS': {
|
||||
'debug': DEBUG,
|
||||
'loaders': [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
],
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.template.context_processors.media',
|
||||
'django.template.context_processors.static',
|
||||
'django.template.context_processors.tz',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
if os.path.isdir(local_dir('templates')):
|
||||
TEMPLATES[0]['DIRS'].insert(0, local_dir('templates'))
|
||||
|
||||
# FIXTURES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#fixture-dirs
|
||||
FIXTURE_DIRS = (
|
||||
root_dir('fixtures'),
|
||||
)
|
||||
|
||||
# EMAIL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/topics/email/#email-backends
|
||||
# https://django-environ.readthedocs.io/en/stable/#supported-types
|
||||
vars().update(env.email_url(
|
||||
'DJANGO_EMAIL_URL', default='smtp://localhost:25'))
|
||||
|
||||
DEFAULT_FROM_EMAIL = env('DEFAULT_FROM_EMAIL', default='webmaster@localhost')
|
||||
# Use the same email address for error messages
|
||||
SERVER_EMAIL = DEFAULT_FROM_EMAIL
|
||||
|
||||
# ADMIN
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#admins
|
||||
ADMINS = [
|
||||
("""Cliss XXI""", 'tech@cliss21.com'),
|
||||
]
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#managers
|
||||
MANAGERS = ADMINS
|
||||
|
||||
# SESSIONS AND COOKIES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#session-cookie-path
|
||||
SESSION_COOKIE_PATH = APP_LOCATION
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#csrf-cookie-path
|
||||
CSRF_COOKIE_PATH = APP_LOCATION
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# APPLICATION AND 3RD PARTY LIBRARY SETTINGS
|
||||
# ------------------------------------------------------------------------------
|
|
@ -0,0 +1,53 @@
|
|||
"""
|
||||
Development settings.
|
||||
|
||||
- use Console backend for emails sending by default
|
||||
- add the django-debug-toolbar
|
||||
"""
|
||||
from .base import * # noqa
|
||||
from .base import env
|
||||
|
||||
# GENERAL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#secret-key
|
||||
SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=[
|
||||
'localhost',
|
||||
'0.0.0.0',
|
||||
'127.0.0.1',
|
||||
])
|
||||
|
||||
# EMAIL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/topics/email/#email-backends
|
||||
# https://django-environ.readthedocs.io/en/stable/#supported-types
|
||||
vars().update(env.email_url(
|
||||
'DJANGO_EMAIL_URL', default='consolemail://'))
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# APPLICATION AND 3RD PARTY LIBRARY SETTINGS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# DJANGO DEBUG TOOLBAR
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://django-debug-toolbar.readthedocs.io/en/stable/installation.html
|
||||
MIDDLEWARE += ['debug_toolbar.middleware.DebugToolbarMiddleware'] # noqa: F405
|
||||
INSTALLED_APPS += ['debug_toolbar'] # noqa: F405
|
||||
|
||||
INTERNAL_IPS = ['127.0.0.1']
|
||||
|
||||
DEBUG_TOOLBAR_CONFIG = {
|
||||
'DISABLE_PANELS': [
|
||||
'debug_toolbar.panels.redirects.RedirectsPanel',
|
||||
],
|
||||
'SHOW_TEMPLATE_CONTEXT': True,
|
||||
# Uncomment if jQuery is already loaded by your assets:
|
||||
# 'JQUERY_URL': '',
|
||||
}
|
||||
|
||||
# DJANGO EXTENSIONS
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://django-extensions.readthedocs.io/en/stable/index.html
|
||||
INSTALLED_APPS += ['django_extensions'] # noqa: F405
|
|
@ -0,0 +1,103 @@
|
|||
"""
|
||||
Production settings.
|
||||
|
||||
- validate the configuration
|
||||
- disable debug mode
|
||||
- load secret key from environment variables
|
||||
- set other production configurations
|
||||
"""
|
||||
import os
|
||||
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
|
||||
from .base import * # noqa
|
||||
from .base import env, var_dir
|
||||
|
||||
# CONFIGURATION VALIDATION
|
||||
# ------------------------------------------------------------------------------
|
||||
# Ensure that the database configuration has been set
|
||||
if not env('DJANGO_DATABASE_URL', default=None):
|
||||
raise ImproperlyConfigured(
|
||||
"No database configuration has been set, you should check "
|
||||
"the value of your DATABASE_URL environment variable."
|
||||
)
|
||||
|
||||
# Ensure that the default email address has been set
|
||||
if not env('DEFAULT_FROM_EMAIL', default=None):
|
||||
raise ImproperlyConfigured(
|
||||
"No default email address has been set, you should check "
|
||||
"the value of your DEFAULT_FROM_EMAIL environment variable."
|
||||
)
|
||||
|
||||
# GENERAL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#debug
|
||||
DEBUG = False
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#secret-key
|
||||
SECRET_KEY = env('DJANGO_SECRET_KEY')
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#allowed-hosts
|
||||
ALLOWED_HOSTS = env.list('DJANGO_ALLOWED_HOSTS', default=[])
|
||||
|
||||
# TEMPLATES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#templates
|
||||
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # noqa F405
|
||||
TEMPLATES[0]['OPTIONS']['loaders'] = [ # noqa F405
|
||||
('django.template.loaders.cached.Loader', [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
]),
|
||||
]
|
||||
|
||||
# LOGGING
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/topics/logging/
|
||||
LOGGING = {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters': {
|
||||
'verbose': {
|
||||
'format': '%(asctime)s - %(levelname)s - %(module)s: %(message)s',
|
||||
},
|
||||
},
|
||||
'handlers': {
|
||||
'mail_admins': {
|
||||
'level': 'ERROR',
|
||||
'class': 'django.utils.log.AdminEmailHandler'
|
||||
},
|
||||
'file': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.handlers.TimedRotatingFileHandler',
|
||||
'filename': var_dir('log/chronos.log'),
|
||||
'formatter': 'verbose',
|
||||
'when': 'midnight',
|
||||
'interval': 1,
|
||||
'backupCount': 30,
|
||||
},
|
||||
},
|
||||
'loggers': {
|
||||
'django': {
|
||||
'level': 'WARNING',
|
||||
'handlers': ['file'],
|
||||
'propagate': True,
|
||||
},
|
||||
'django.request': {
|
||||
'level': 'WARNING',
|
||||
'handlers': ['file', 'mail_admins'],
|
||||
'propagate': True,
|
||||
},
|
||||
'chronos': {
|
||||
'level': 'INFO',
|
||||
'handlers': ['file', 'mail_admins'],
|
||||
'propagate': True,
|
||||
},
|
||||
},
|
||||
}
|
||||
if not os.path.isdir(var_dir('log')):
|
||||
os.mkdir(var_dir('log'), mode=0o750)
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# APPLICATION AND 3RD PARTY LIBRARY SETTINGS
|
||||
# ------------------------------------------------------------------------------
|
|
@ -0,0 +1,51 @@
|
|||
"""
|
||||
With these settings, tests run faster.
|
||||
"""
|
||||
from .base import * # noqa
|
||||
from .base import env
|
||||
|
||||
# GENERAL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#debug
|
||||
DEBUG = False
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#secret-key
|
||||
SECRET_KEY = env('DJANGO_SECRET_KEY', default='CHANGEME!!!')
|
||||
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#test-runner
|
||||
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
||||
|
||||
# CACHES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#caches
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
|
||||
'LOCATION': '',
|
||||
},
|
||||
}
|
||||
|
||||
# PASSWORDS
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#password-hashers
|
||||
PASSWORD_HASHERS = ['django.contrib.auth.hashers.MD5PasswordHasher']
|
||||
|
||||
# TEMPLATES
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#templates
|
||||
TEMPLATES[0]['OPTIONS']['debug'] = DEBUG # noqa: F405
|
||||
TEMPLATES[0]['OPTIONS']['loaders'] = [ # noqa: F405
|
||||
('django.template.loaders.cached.Loader', [
|
||||
'django.template.loaders.filesystem.Loader',
|
||||
'django.template.loaders.app_directories.Loader',
|
||||
]),
|
||||
]
|
||||
|
||||
# EMAIL
|
||||
# ------------------------------------------------------------------------------
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#email-backend
|
||||
EMAIL_BACKEND = 'django.core.mail.backends.locmem.EmailBackend'
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#email-host
|
||||
EMAIL_HOST = 'localhost'
|
||||
# https://docs.djangoproject.com/en/stable/ref/settings/#email-port
|
||||
EMAIL_PORT = 1025
|
Fichier diff supprimé car celui-ci est trop grand
Voir la Diff
Diff de fichier supprimé car une ou plusieurs lignes sont trop longues
Diff de fichier supprimé car une ou plusieurs lignes sont trop longues
Fichier diff supprimé car celui-ci est trop grand
Voir la Diff
Diff de fichier supprimé car une ou plusieurs lignes sont trop longues
Diff de fichier supprimé car une ou plusieurs lignes sont trop longues
Fichier binaire non affiché.
Fichier diff supprimé car celui-ci est trop grand
Voir la Diff
Après Largeur: | Hauteur: | Taille: 455 KiB |
Fichier binaire non affiché.
Fichier binaire non affiché.
Fichier binaire non affiché.
Fichier diff supprimé car celui-ci est trop grand
Voir la Diff
Diff de fichier supprimé car une ou plusieurs lignes sont trop longues
Diff de fichier supprimé car une ou plusieurs lignes sont trop longues
|
@ -0,0 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Page introuvable{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>La page que vous demandez semble introuvable...</p>
|
||||
{% endblock %}
|
|
@ -0,0 +1,7 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Erreur interne{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<p>Une erreur inattendue est survenue...</p>
|
||||
{% endblock %}
|
|
@ -0,0 +1,43 @@
|
|||
{% load staticfiles %}<!DOCTYPE html>
|
||||
<html class="no-js" lang="fr">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="x-ua-compatible" content="ie=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>
|
||||
{% block title %}{% endblock %}
|
||||
{% block title_suffix %}- Chronos{% endblock %}
|
||||
</title>
|
||||
|
||||
<meta name="description" content="">
|
||||
<meta name="keywords" content="">
|
||||
|
||||
{% block css %}
|
||||
<link rel="stylesheet" href="{% static "css/app.css" %}">
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_head %}{% endblock %}
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
{% if messages %}
|
||||
{% for message in messages %}
|
||||
<div class="callout{% if message.tags %} {{ message.tags }}{% endif %}">{{ message }}</div>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
{% block content %}
|
||||
<p>Utilisez ce modèle pour démarrer rapidement une nouvelle application.</p>
|
||||
{% endblock %}
|
||||
|
||||
</div><!-- .container -->
|
||||
|
||||
{% block modal %}{% endblock %}
|
||||
|
||||
{% block javascript %}
|
||||
<script src="{% static "js/app.js" %}"></script>
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,8 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block title %}Accueil{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Bienvenue !</h1>
|
||||
<p>Cette page ne dira pas grand chose de plus, à vous de la personnaliser.</p>
|
||||
{% endblock content %}
|
|
@ -0,0 +1,37 @@
|
|||
from django.conf import settings
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
from .base import urls as base_urls
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
|
||||
# Local applications
|
||||
# ...
|
||||
]
|
||||
|
||||
if settings.DEBUG:
|
||||
from django.conf.urls.static import static
|
||||
from django.views import defaults as default_views
|
||||
|
||||
# This allows the error pages to be debugged during development, just visit
|
||||
# these url in browser to see how these error pages look like.
|
||||
urlpatterns += [
|
||||
path('400/', default_views.bad_request,
|
||||
kwargs={'exception': Exception('Bad Request!')}),
|
||||
path('403/', default_views.permission_denied,
|
||||
kwargs={'exception': Exception('Permission Denied')}),
|
||||
path('404/', default_views.page_not_found,
|
||||
kwargs={'exception': Exception('Page not Found')}),
|
||||
path('500/', default_views.server_error),
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
if 'debug_toolbar' in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
urlpatterns.insert(0, path('__debug__/', include(debug_toolbar.urls)))
|
||||
|
||||
# Root application
|
||||
urlpatterns += [
|
||||
path('', include(base_urls)),
|
||||
]
|
|
@ -0,0 +1,21 @@
|
|||
"""
|
||||
WSGI config for Chronos project.
|
||||
|
||||
This module contains the WSGI application used by Django's development server
|
||||
and any production WSGI deployments. It should expose a module-level variable
|
||||
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
|
||||
this application via the ``WSGI_APPLICATION`` setting.
|
||||
"""
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
from chronos.settings import DJANGO_SETTINGS_MODULE
|
||||
|
||||
# Set the default settings module to use.
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', DJANGO_SETTINGS_MODULE)
|
||||
|
||||
# This application object is used by any WSGI server configured to use this
|
||||
# file. This includes Django's development server, if the WSGI_APPLICATION
|
||||
# setting points here.
|
||||
application = get_wsgi_application()
|
Certains fichiers ne sont pas affichés car ce diff contient trop de modifications Voir plus
Chargement…
Référencer dans un nouveau ticket