Skip to content
Snippets Groups Projects
Commit 3dce0f06 authored by Fabrice Salvaire's avatar Fabrice Salvaire
Browse files

uncommited update

parent 7156c17e
No related branches found
No related tags found
No related merge requests found
......@@ -59,4 +59,3 @@ trash.py
ClimbingAssoPortal/static-src/build/
root
static-src
\ No newline at end of file
......@@ -27,6 +27,7 @@
"react-bootstrap-slider": "^2.1.3",
"react-dom": "^16.3.0",
"react-intl": "^2.4.0",
"react-show": "^2.0.4",
"react-table": "^6.8.0",
"rxjs": "^5.5.8",
"select2": "^4.0.6-rc.1",
......
......@@ -53,69 +53,92 @@ ROOT_URLCONF = 'ClimbingAssoPortalSite.urls'
WSGI_APPLICATION = 'ClimbingAssoPortalSite.wsgi.application'
####################################################################################################
# USE_PROMETHEUS = True
USE_PROMETHEUS = False
####################################################################################################
#
# Application definition
#
# /!\ INSTALLED_APPS is an ordered list
INSTALLED_APPS = [
# /!\ ordered list
# http://django-suit.readthedocs.io/en/develop
'suit', # must be added before admin
# 'ClimbingAssoPortal.apps.SuitConfig', # custom suit v2 config
# http://django-suit.readthedocs.io/en/develop
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.gis', # https://docs.djangoproject.com/en/2.0/ref/contrib/gis/
'django.contrib.sites',
]
INSTALLED_APPS += [
'rest_framework', # http://www.django-rest-framework.org
'django_filters', # https://django-filter.readthedocs.io/en/latest
'rest_framework_gis', # https://github.com/djangonauts/django-rest-framework-gis
'rest_framework_swagger', # https://django-rest-swagger.readthedocs.io/en/latest
'drf_yasg', # https://drf-yasg.readthedocs.io/en/stable/
# used by DRF filter
'crispy_forms', # http://django-crispy-forms.readthedocs.io/en/latest/
'graphene_django', # http://docs.graphene-python.org/projects/django/en/latest
]
INSTALLED_APPS += [
# http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#using-celery-with-django
'django_celery_results', # http://django-celery-results.readthedocs.io/en/latest/
'django_celery_beat', # http://django-celery-beat.readthedocs.io/en/latest/
]
INSTALLED_APPS += [
'health_check', # http://django-health-check.readthedocs.io/en/latest/index.html
'health_check.db', # stock Django health checkers
'health_check.cache',
'health_check.storage',
# 'health_check.contrib.celery', # requires celery
'health_check.contrib.psutil', # disk and memory utilization; requires psutil
]
if USE_PROMETHEUS:
INSTALLED_APPS.append('prometheus')
INSTALLED_APPS += [
'reversion', # https://django-reversion.readthedocs.io/en/stable
'django_jinja', # http://niwinz.github.io/django-jinja/latest
'bootstrapform', # https://github.com/tzangms/django-bootstrap-form
'django_filters', # https://django-filter.readthedocs.io/en/latest
'django_jinja', # http://niwinz.github.io/django-jinja/latest
'django_select2', # http://django-select2.readthedocs.io/en/latest
'bootstrapform', # https://github.com/tzangms/django-bootstrap-form
'crispy_forms', # http://django-crispy-forms.readthedocs.io/en/latest/ # used by DRF filter
# 'pinax_theme_bootstrap', # https://github.com/pinax/pinax-theme-bootstrap
'account', # http://django-user-accounts.readthedocs.io/en/latest
# https://django-filer.readthedocs.io
'easy_thumbnails',
'filer',
'mptt',
'filer', # https://django-filer.readthedocs.io
#! 'mptt',
]
# http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#using-celery-with-django
'django_celery_results', # http://django-celery-results.readthedocs.io/en/latest/
'django_celery_beat', # http://django-celery-beat.readthedocs.io/en/latest/
INSTALLED_APPS += [
'ClimbingAssoPortal.apps.ClimbingAssoPortalConfig',
]
'health_check', # http://django-health-check.readthedocs.io/en/latest/index.html
'health_check.db', # stock Django health checkers
'health_check.cache',
'health_check.storage',
# 'health_check.contrib.celery', # requires celery
'health_check.contrib.psutil', # disk and memory utilization; requires psutil
# https://github.com/applecat/django-simple-poll
# https://github.com/byteweaver/django-polls
# https://github.com/hmtanbir/django-easy-poll
'graphene_django', # http://docs.graphene-python.org/projects/django/en/latest
####################################################################################################
'ClimbingAssoPortal.apps.ClimbingAssoPortalConfig',
MIDDLEWARE_CLASSES = []
# https://github.com/applecat/django-simple-poll
# https://github.com/byteweaver/django-polls
# https://github.com/hmtanbir/django-easy-poll
]
if USE_PROMETHEUS:
MIDDLEWARE_CLASSES.append('django_prometheus.middleware.PrometheusBeforeMiddleware')
MIDDLEWARE = [
#! 'django.middleware.cache.UpdateCacheMiddleware',
......@@ -137,6 +160,9 @@ MIDDLEWARE = [
#! 'django.middleware.cache.FetchFromCacheMiddleware',
]
if USE_PROMETHEUS:
MIDDLEWARE_CLASSES.append('django_prometheus.middleware.PrometheusAfterMiddleware')
####################################################################################################
#
# Template
......
......@@ -146,6 +146,10 @@ AUTH_PASSWORD_VALIDATORS = [ # FOR DEV TEST ONLY !!!
POSTGRESQL_DESCRIPTION = 'Climbing Asso Portal Database'
POSTGRESQL_LOCAL = 'fr_FR.UTF8'
# Fixme: postgis ???
# if settings.USE_PROMETHEUS:
# engine = 'django_prometheus.db.backends.XXX'
DATABASES = {
# 'default': {
# 'ENGINE': 'django.db.backends.sqlite3',
......@@ -208,6 +212,9 @@ CACHES = {
}
}
# if USE_PROMETHEUS:
# memcached_backend = 'django_prometheus.cache.backends.memcached',
# CACHES = {
# 'default': {
# 'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
......
......@@ -55,12 +55,16 @@ urlpatterns = [
# Admin install this autocomplete feature where term are searched in search_fields
# /admin/APPLICATION/MODEL/autocomplete/?term=XYZ
path('health_status/{}/'.format(settings.HEALTH_CHECK_URL_KEY), include('health_check.urls')),
path('filer/', include('filer.urls')),
path('account/', include('account.urls')),
path('filer/', include('filer.urls')),
path('health_status/{}/'.format(settings.HEALTH_CHECK_URL_KEY), include('health_check.urls')),
path('select2/', include('django_select2.urls')),
]
if settings.USE_PROMETHEUS:
urlpatterns.append(path('', include('django_prometheus.urls')))
urlpatterns += [
path('', include('ClimbingAssoPortal.urls')),
]
......
......@@ -20,6 +20,8 @@
"""Module to implement duration in second.
See also :mode:`datetime.timedelta`
Example of usage::
dt = 10@u_s
......@@ -40,63 +42,87 @@ Example of usage::
__all__ = [
'Duration',
'u_s',
'u_min',
'u_hour',
'u_day',
]
####################################################################################################
class Duration:
class IntUnit:
##############################################
def __init__(self, value):
self._value = value
##############################################
def __int__(self):
return int(self._value)
##############################################
def __float__(self):
def __str__(self):
return str(self._value)
return float(self._value)
##############################################
def __mul__(self, other):
return self.__class__(int(self) * int(other))
##############################################
def __str__(self):
def __rmatmul__(self, other):
return self.__mul__(other)
return str(self._value)
##############################################
def __imul__(self, other):
self._value *= int(other)
return self
##############################################
def __mul__(self, other):
def __rmul__(self, other):
return self.__mul__(other)
##############################################
return Duration(self._value * float(other))
def __truediv__(self, other):
return int(self) / int(other)
####################################################################################################
class FloatUnit(IntUnit):
##############################################
def __mul__(self, other):
def __float__(self):
return float(self._value)
return Duration(float(self) * float(other))
##############################################
def __mul__(self, other):
return self.__class__(float(self) * float(other))
##############################################
def __rmul__(self, other):
return self.__mul__(other)
def __imul__(self, other):
self._value *= float(other)
return self
##############################################
def __rmatmul__(self, other):
return self.__mul__(other)
def __truediv__(self, other):
return float(self) / float(other)
####################################################################################################
class Duration(FloatUnit):
pass
u_s = Duration(1)
u_min = Duration(60)
u_min = u_s * 60
u_hour = u_min * 60
u_day = u_hour * 24
# Markdown==2.6.11
# Pillow==5.0.0
Django==2.0.3
IntervalArithmetic
IntervalArithmetic=0.2.0
Jinja2==2.10
celery==4.1.0
coreapi==2.3.3
......@@ -21,4 +21,5 @@ djangorestframework-gis==0.12
djangorestframework==3.7.7
drf-yasg[validation]==1.6.0
easy-thumbnails==2.5
prometheus_client=0.2.0
requests==2.18.4
......@@ -2,4 +2,4 @@
Sphinx==1.7.1
django_babel==0.6.2
ansicolors==1.1.8
googletrans
googletrans==2.2.0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment