diff --git a/app/escriptorium/context_processors.py b/app/escriptorium/context_processors.py new file mode 100644 index 0000000000000000000000000000000000000000..0cb8536ee0569d734e9e5408622e1194f66fc7d1 --- /dev/null +++ b/app/escriptorium/context_processors.py @@ -0,0 +1,5 @@ +from django.conf import settings + + +def custom_homepage(request): + return {'CUSTOM_HOME': getattr(settings, 'CUSTOM_HOME', False)} diff --git a/app/escriptorium/local_settings.py.example b/app/escriptorium/local_settings.py.example index 56d974991e957b565b652834acc7908e2271b7c5..d7337561f992b14c43c74383d592ee9316429fee 100644 --- a/app/escriptorium/local_settings.py.example +++ b/app/escriptorium/local_settings.py.example @@ -39,3 +39,8 @@ DEBUG_TOOLBAR_PANELS = [ ] # USE_CELERY = False +# CELERY_TASK_ALWAYS_EAGER = True + +# LOGGING['loggers']['kraken']['level'] = 'DEBUG' + +# CUSTOM_HOME = True diff --git a/app/escriptorium/settings.py b/app/escriptorium/settings.py index 222e9f0b9fd0f8f2285bcef3322674d535442625..1bb762b2535c4650b040c52a7cca79ddb06bf288 100644 --- a/app/escriptorium/settings.py +++ b/app/escriptorium/settings.py @@ -41,6 +41,8 @@ SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = os.getenv('DEBUG', False) +CUSTOM_HOME = os.getenv('CUSTOM_HOME', False) + ALLOWED_HOSTS = ['*'] ASGI_APPLICATION = "escriptorium.routing.application" @@ -87,7 +89,8 @@ ROOT_URLCONF = 'escriptorium.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(PROJECT_ROOT, 'templates')], + 'DIRS': [os.path.join(PROJECT_ROOT, 'templates'), + os.path.join(BASE_DIR, 'homepage')], # custom homepage dir (volume in docker) 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ @@ -95,6 +98,7 @@ TEMPLATES = [ 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', + 'escriptorium.context_processors.custom_homepage' ], }, }, @@ -218,6 +222,7 @@ STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATICFILES_DIRS = [ os.path.join(PROJECT_ROOT, 'static'), + os.path.join(BASE_DIR, 'homepage'), # custom homepage directory FRONTEND_DIR ] diff --git a/app/escriptorium/static/images/inria.png b/app/escriptorium/static/images/inria.png index bbec4993b89fd379f1bc859c2723c7ff931b7b4d..b2997fd5a37783cd23d6962dfa692ee9773cbe0a 100644 Binary files a/app/escriptorium/static/images/inria.png and b/app/escriptorium/static/images/inria.png differ diff --git a/app/escriptorium/templates/core/home.html b/app/escriptorium/templates/core/home.html index 71628f572f624d764a50d1716c98512ac4595db7..e06dca6ba274e36bfa1605325c1127a6f6d21d55 100644 --- a/app/escriptorium/templates/core/home.html +++ b/app/escriptorium/templates/core/home.html @@ -8,6 +8,9 @@ <div class="jumbotron text-center bg-light"> <h1 class="jumbotron-heading">eScriptorium</h1> <p class="lead text-muted">{% trans "A project providing digital recognition of handwritten documents using machine learning techniques." %}</p> + {% if CUSTOM_HOME %} + {% include "additional_heading.html" %} + {% endif %} </div> <div class="container my-5"> @@ -32,45 +35,56 @@ <hr/> </div> -<div class="my-5 container-fluid text-center"> - <a href="https://www.ephe.psl.eu"> - <img src="{% static "images/ephe.png" "%}" alt="EPHE logo" height="100"> - </a> - <a href="https://scripta.psl.eu/en/" class="pl-4"> - <img src="{% static "images/pslscripta.png" "%}" alt="Scripta PSL logo" height="80"> - </a> - <a href="https://ec.europa.eu/programmes/horizon2020/" class="pl-4"> - <img src="{% static "images/h2020.jpg" "%}" alt="Horizon 2020 logo" height="100"> - </a> +<div class="row"> + <div class="my-5 container-fluid text-center"> + <a href="https://www.ephe.psl.eu" target="_blank"> + <img src="{% static "images/ephe.png" "%}" alt="EPHE logo" height="100"> + </a> + <a href="https://scripta.psl.eu/en/" class="pl-4" target="_blank"> + <img src="{% static "images/pslscripta.png" "%}" alt="Scripta PSL logo" height="60"> + </a> - <a href="https://www.openiti.org/" class="pl-4"> - <img src="{% static "images/openiti.png" "%}" alt="DIM Region ile de france logo" height="100"> - </a> + <a href="https://ec.europa.eu/programmes/horizon2020/" class="pl-4" target="_blank"> + <img src="{% static "images/h2020.jpg" "%}" alt="Horizon 2020 logo" height="100"> + </a> - <a href="https://www.iledefrance.fr/des-aides-la-recherche-pour-13-domaines-dinteret-majeur" class="pl-4"> - <img src="{% static "images/regionidf.jpg" "%}" alt="DIM Region ile de france logo" height="100"> - </a> + <a href="https://www.openiti.org/" class="pl-4" target="_blank"> + <img src="{% static "images/openiti.png" "%}" alt="DIM Region ile de france logo" height="90"> + </a> - <a href="https://inria.fr/fr" class="pl-4"> - <img src="{% static "images/inria.png" "%}" alt="INRIA logo" height="100"> - </a> + <a href="https://www.iledefrance.fr/des-aides-la-recherche-pour-13-domaines-dinteret-majeur" class="pl-4" target="_blank"> + <img src="{% static "images/regionidf.jpg" "%}" alt="DIM Region ile de france logo" height="100"> + </a> + <a href="https://inria.fr/fr" class="pl-4" target="_blank"> + <img src="{% static "images/inria.png" "%}" alt="INRIA logo" height="60"> + </a> + </div> + + {% if CUSTOM_HOME %} + {% include "additional_icons.html" %} + {% endif %} </div> -<footer class="bg-light"> - <div class="container py-2"> - <div class="col-6"> - <h5>{% trans "Resources" %}</h5> - <ul class="list-unstyled" %} - <li><a href="https://lectaurep.hypotheses.org/documentation/escriptorium-tutorial-en">{% trans "Tutorial" %}</a></li> - <li><a href="https://gitlab.inria.fr/scripta/escriptorium">{% trans "eScriptorium open source code" %}</a> Version {{ VERSION_DATE }}</li> - <li><a href="https://escripta.hypotheses.org/">{% trans "Scripta Blog" %}</a></li> - <li><a href="http://kraken.re/">{{ KRAKEN_VERSION|capfirst }}</a></li> - <li><a href="https://gitlab.inria.fr/scripta/escriptorium/-/wikis/home">Wiki</a></li> - </ul> +<footer class="bg-light mt-5 pt-1"> + <div class="container"> + <div class="row"> + <div class="col-6"> + <h5>{% trans "Resources" %}</h5> + <ul class="list-unstyled"> + <li><a href="https://lectaurep.hypotheses.org/documentation/escriptorium-tutorial-en" target="_blank">{% trans "Tutorial" %}</a></li> + <li><a href="https://gitlab.inria.fr/scripta/escriptorium" target="_blank">{% trans "eScriptorium open source code" %}</a> Version {{ VERSION_DATE }}</li> + <li><a href="https://escripta.hypotheses.org/" target="_blank">{% trans "Scripta Blog" %}</a></li> + <li><a href="http://kraken.re/" target="_blank">{{ KRAKEN_VERSION|capfirst }}</a></li> + <li><a href="https://gitlab.inria.fr/scripta/escriptorium/-/wikis/home" target="_blank">Wiki</a></li> + </ul> + </div> + + {% if CUSTOM_HOME %} + {% include "additional_footer.html" %} + {% endif %} </div> </div> </footer> - {% endblock %} diff --git a/app/homepage_example/additional_footer.html b/app/homepage_example/additional_footer.html new file mode 100644 index 0000000000000000000000000000000000000000..3b3cfba9bf0b49f68a2180447e47c3f869088f00 --- /dev/null +++ b/app/homepage_example/additional_footer.html @@ -0,0 +1,9 @@ +{% load i18n %} +<div class="col-6"> + <h5>{% trans "Powered by" %}</h5> + <ul class="list-unstyled"> + <li><a href="https://www.python.org" target="_blank">Python</a></li> + <li><a href="https://www.djangoproject.com" target="_blank">Django</a></li> + <li><a href="https://vuejs.org" target="_blank">Vue.js</a></li> + </ul> +</div> diff --git a/app/homepage_example/additional_heading.html b/app/homepage_example/additional_heading.html new file mode 100644 index 0000000000000000000000000000000000000000..8eb1c6a8ff5174d9e1d9ec129933392396793610 --- /dev/null +++ b/app/homepage_example/additional_heading.html @@ -0,0 +1 @@ +<p>eScriptorium accounts are created on invitation only for now. If your institution doesn't provide it, you can use the contact form to ask for access.</p> diff --git a/app/homepage_example/additional_icons.html b/app/homepage_example/additional_icons.html new file mode 100644 index 0000000000000000000000000000000000000000..1b6ece1af55126823c5e18d33b69f9d626352b21 --- /dev/null +++ b/app/homepage_example/additional_icons.html @@ -0,0 +1,11 @@ +{% load staticfiles %} +</div> <!-- example to create another row --> +<div class="row"> + <div class="container-fluid text-center"> + <a href="http://www.python.org" target="_blank"> + <img src="{% static "python.png" %}" alt="custom logo" height="50"> + </a> + <a href="http://www.djangoproject.com" target="_blank"> + <img src="{% static "django.png" %}" alt="custom logo" height="50"> + </a> + </div> diff --git a/app/homepage_example/django.png b/app/homepage_example/django.png new file mode 100644 index 0000000000000000000000000000000000000000..2a1d873eeb34af6bf0c69baec82fe45e1bf749b9 Binary files /dev/null and b/app/homepage_example/django.png differ diff --git a/app/homepage_example/python.png b/app/homepage_example/python.png new file mode 100644 index 0000000000000000000000000000000000000000..a215d687b662d4a105fc116492d0a3add6435cfb Binary files /dev/null and b/app/homepage_example/python.png differ