diff --git a/docs/backup-photos b/docs/backup-photos index 9f00d93..e76dd87 100644 --- a/docs/backup-photos +++ b/docs/backup-photos @@ -1,4 +1,7 @@ #!/bin/sh # Backup script to put in /etc/cron.montly/ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later rsync -avP /var/www/photos/photo21 /backup/ sudo -u postgres pg_dump photo21 > /backup/pg_dump_photo21.sql diff --git a/docs/nginx_photos b/docs/nginx_photos index 19b0154..229f7b5 100644 --- a/docs/nginx_photos +++ b/docs/nginx_photos @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + server { listen 80; listen [::]:80; diff --git a/docs/uwsgi_photos.ini b/docs/uwsgi_photos.ini index c15bf29..60cfa48 100644 --- a/docs/uwsgi_photos.ini +++ b/docs/uwsgi_photos.ini @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + [uwsgi] # www-data can write media uid = www-data diff --git a/manage.py b/manage.py index 22fa524..8319215 100755 --- a/manage.py +++ b/manage.py @@ -5,7 +5,7 @@ import sys def main(): - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'photo21.settings') + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "photo21.settings") try: from django.core.management import execute_from_command_line except ImportError as exc: @@ -17,5 +17,5 @@ def main(): execute_from_command_line(sys.argv) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/photo21/__init__.py b/photo21/__init__.py index e69de29..6c9e378 100644 --- a/photo21/__init__.py +++ b/photo21/__init__.py @@ -0,0 +1,3 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/photo21/forms.py b/photo21/forms.py index a4cb52b..a54aabc 100644 --- a/photo21/forms.py +++ b/photo21/forms.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + from django import forms from django.utils.translation import gettext_lazy as _ from allauth.account.forms import SignupForm @@ -18,7 +22,9 @@ class CustomSignupForm(SignupForm): Check that the email address ends with a trusted domain. """ email = super().clean_email() - if not email.endswith("@crans.org") and not email.endswith("@ens-paris-saclay.fr"): + if not email.endswith("@crans.org") and not email.endswith( + "@ens-paris-saclay.fr" + ): raise forms.ValidationError( _("Must end with `@crans.org` or `@ens-paris-saclay.fr`.") ) diff --git a/photo21/hashers.py b/photo21/hashers.py index 0c3305a..de29ba8 100644 --- a/photo21/hashers.py +++ b/photo21/hashers.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + import hashlib import base64 from collections import OrderedDict @@ -15,11 +19,12 @@ class SHA512PasswordHasher(BasePasswordHasher): It is used to migrate passwords from old Symfony2 photos server. https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/Security/Core/Encoder/MessageDigestPasswordEncoder.php """ + algorithm = "sha512" def encode(self, password, iteration, salt): assert password is not None - assert salt and '$' not in salt + assert salt and "$" not in salt salted = force_bytes(password + "{" + salt + "}") digest = hashlib.sha512(salted).digest() # "stretch" hash @@ -30,19 +35,21 @@ class SHA512PasswordHasher(BasePasswordHasher): return encoded[:128] def verify(self, password, encoded): - algorithm, iteration, salt, hash = encoded.split('$', 3) + algorithm, iteration, salt, hash = encoded.split("$", 3) assert algorithm == self.algorithm encoded_2 = self.encode(password, iteration, salt) return constant_time_compare(encoded, encoded_2) def safe_summary(self, encoded): - algorithm, iteration, salt, hash = encoded.split('$', 3) + algorithm, iteration, salt, hash = encoded.split("$", 3) assert algorithm == self.algorithm - return OrderedDict([ - (_('algorithm'), algorithm), - (_('salt'), mask_hash(salt, show=2)), - (_('hash'), mask_hash(hash)), - ]) + return OrderedDict( + [ + (_("algorithm"), algorithm), + (_("salt"), mask_hash(salt, show=2)), + (_("hash"), mask_hash(hash)), + ] + ) def harden_runtime(self, password, encoded): pass diff --git a/photo21/locale/de/LC_MESSAGES/django.po b/photo21/locale/de/LC_MESSAGES/django.po index d45572b..6593a81 100644 --- a/photo21/locale/de/LC_MESSAGES/django.po +++ b/photo21/locale/de/LC_MESSAGES/django.po @@ -1,7 +1,6 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later # #, fuzzy msgid "" diff --git a/photo21/locale/es/LC_MESSAGES/django.po b/photo21/locale/es/LC_MESSAGES/django.po index f05fed8..083830d 100644 --- a/photo21/locale/es/LC_MESSAGES/django.po +++ b/photo21/locale/es/LC_MESSAGES/django.po @@ -1,7 +1,6 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later # #, fuzzy msgid "" diff --git a/photo21/locale/fr/LC_MESSAGES/django.po b/photo21/locale/fr/LC_MESSAGES/django.po index 7d7d518..587e078 100644 --- a/photo21/locale/fr/LC_MESSAGES/django.po +++ b/photo21/locale/fr/LC_MESSAGES/django.po @@ -1,7 +1,6 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later # #, fuzzy msgid "" diff --git a/photo21/settings.py b/photo21/settings.py index e0d25b6..8bd46dd 100644 --- a/photo21/settings.py +++ b/photo21/settings.py @@ -1,8 +1,10 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + """ Django settings for photo21 project. -Generated by 'django-admin startproject' using Django 2.2.24. - For more information on this file, see https://docs.djangoproject.com/en/2.2/topics/settings/ @@ -23,7 +25,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'CHANGE ME' +SECRET_KEY = "CHANGE ME" # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False @@ -38,7 +40,7 @@ ALLOWED_HOSTS = [ # Admins receive server errors, this is useful to be notified of potential bugs # By default MANAGERS=ADMINS, so admins also receive upload notifications ADMINS = [ - ('admin', 'photos-admin@lists.crans.org'), + ("admin", "photos-admin@lists.crans.org"), ] # Use secure cookies in production @@ -53,47 +55,47 @@ SECURE_HSTS_PRELOAD = True # Application definition INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.admindocs', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'allauth', - 'allauth.account', - 'allauth.socialaccount', - 'allauth_note_kfet', - 'crispy_forms', - 'photologue', + "django.contrib.admin", + "django.contrib.admindocs", + "django.contrib.auth", + "django.contrib.contenttypes", + "django.contrib.sessions", + "django.contrib.sites", + "django.contrib.messages", + "django.contrib.staticfiles", + "allauth", + "allauth.account", + "allauth.socialaccount", + "allauth_note_kfet", + "crispy_forms", + "photologue", ] 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', - 'django.middleware.locale.LocaleMiddleware', - 'django.contrib.sites.middleware.CurrentSiteMiddleware', + "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", + "django.middleware.locale.LocaleMiddleware", + "django.contrib.sites.middleware.CurrentSiteMiddleware", ] -ROOT_URLCONF = 'photo21.urls' +ROOT_URLCONF = "photo21.urls" TEMPLATES = [ { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [os.path.join(BASE_DIR, 'photo21/templates')], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', + "BACKEND": "django.template.backends.django.DjangoTemplates", + "DIRS": [os.path.join(BASE_DIR, "photo21/templates")], + "APP_DIRS": True, + "OPTIONS": { + "context_processors": [ + "django.template.context_processors.debug", + "django.template.context_processors.request", + "django.contrib.auth.context_processors.auth", + "django.contrib.messages.context_processors.messages", ], }, }, @@ -101,22 +103,21 @@ TEMPLATES = [ AUTHENTICATION_BACKENDS = [ # Needed to login by username in Django admin, regardless of `allauth` - 'django.contrib.auth.backends.ModelBackend', - + "django.contrib.auth.backends.ModelBackend", # `allauth` specific authentication methods, such as login by e-mail - 'allauth.account.auth_backends.AuthenticationBackend', + "allauth.account.auth_backends.AuthenticationBackend", ] -WSGI_APPLICATION = 'photo21.wsgi.application' +WSGI_APPLICATION = "photo21.wsgi.application" # Database # https://docs.djangoproject.com/en/2.2/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": os.path.join(BASE_DIR, "db.sqlite3"), } } @@ -126,38 +127,38 @@ DATABASES = { AUTH_PASSWORD_VALIDATORS = [ { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + "NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + "NAME": "django.contrib.auth.password_validation.MinimumLengthValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + "NAME": "django.contrib.auth.password_validation.CommonPasswordValidator", }, { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + "NAME": "django.contrib.auth.password_validation.NumericPasswordValidator", }, ] PASSWORD_HASHERS = [ - 'django.contrib.auth.hashers.PBKDF2PasswordHasher', - 'photo21.hashers.SHA512PasswordHasher', + "django.contrib.auth.hashers.PBKDF2PasswordHasher", + "photo21.hashers.SHA512PasswordHasher", ] # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ -TIME_ZONE = 'UTC' +TIME_ZONE = "UTC" USE_TZ = True # Limit available languages to this subset LANGUAGES = [ - ('de', _('German')), - ('en', _('English')), - ('es', _('Spanish')), - ('fr', _('French')), + ("de", _("German")), + ("en", _("English")), + ("es", _("Spanish")), + ("fr", _("French")), ] # Allow more fields in URL to edit large galleries @@ -166,9 +167,9 @@ DATA_UPLOAD_MAX_NUMBER_FIELDS = 10240 # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/2.2/howto/static-files/ -STATIC_URL = '/static/' +STATIC_URL = "/static/" STATICFILES_DIRS = [ - os.path.join(BASE_DIR, 'photo21/static'), + os.path.join(BASE_DIR, "photo21/static"), ] # Collect statics to /static/ @@ -177,48 +178,48 @@ STATIC_ROOT = os.path.join(BASE_DIR, "static/") # Use /media/ for user uploaded media MEDIA_ROOT = os.path.join(BASE_DIR, "media") -MEDIA_URL = '/media/' +MEDIA_URL = "/media/" -LOCALE_PATHS = [os.path.join(BASE_DIR, 'photo21/locale')] +LOCALE_PATHS = [os.path.join(BASE_DIR, "photo21/locale")] -FIXTURE_DIRS = [os.path.join(BASE_DIR, 'photo21/fixtures')] +FIXTURE_DIRS = [os.path.join(BASE_DIR, "photo21/fixtures")] # Do not send email during debug # By default Django sends mails to localhost:25 without authentification if DEBUG: - EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' + EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" # Mail will be sent from this address SERVER_EMAIL = "photos@crans.org" DEFAULT_FROM_EMAIL = f"Serveur photos <{SERVER_EMAIL}>" -EMAIL_SUBJECT_PREFIX = '[Serveur photos] ' +EMAIL_SUBJECT_PREFIX = "[Serveur photos] " # After login redirect user to transfer page -LOGIN_REDIRECT_URL = '/' +LOGIN_REDIRECT_URL = "/" # Use only one Django Sites SITE_ID = 1 # Django message MESSAGE_TAGS = { - messages.DEBUG: 'alert-secondary', - messages.INFO: 'alert-info', - messages.SUCCESS: 'alert-success', - messages.WARNING: 'alert-warning', - messages.ERROR: 'alert-danger', + messages.DEBUG: "alert-secondary", + messages.INFO: "alert-info", + messages.SUCCESS: "alert-success", + messages.WARNING: "alert-warning", + messages.ERROR: "alert-danger", } # Allauth configuration ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_EMAIL_VERIFICATION = "mandatory" ACCOUNT_AUTHENTICATION_METHOD = "username_email" -ACCOUNT_FORMS = {'signup': 'photo21.forms.CustomSignupForm'} +ACCOUNT_FORMS = {"signup": "photo21.forms.CustomSignupForm"} SOCIALACCOUNT_PROVIDERS = { - 'notekfet': { + "notekfet": { # Fetch user profile - 'SCOPE': ['1_1'], + "SCOPE": ["1_1"], }, } # Use Bootstrap forms -CRISPY_TEMPLATE_PACK = 'bootstrap4' +CRISPY_TEMPLATE_PACK = "bootstrap4" diff --git a/photo21/templates/400.html b/photo21/templates/400.html index 31e60cc..889e7a1 100644 --- a/photo21/templates/400.html +++ b/photo21/templates/400.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photo21/templates/403.html b/photo21/templates/403.html index 9b47b39..d8f7b21 100644 --- a/photo21/templates/403.html +++ b/photo21/templates/403.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photo21/templates/404.html b/photo21/templates/404.html index 77bbc10..38e9e8c 100644 --- a/photo21/templates/404.html +++ b/photo21/templates/404.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photo21/templates/500.html b/photo21/templates/500.html index 6929ad1..df835dc 100644 --- a/photo21/templates/500.html +++ b/photo21/templates/500.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photo21/templates/account/base.html b/photo21/templates/account/base.html index b166325..99e3781 100644 --- a/photo21/templates/account/base.html +++ b/photo21/templates/account/base.html @@ -1,6 +1,8 @@ {% extends "base.html" %} {% comment %} -SPDX-License-Identifier: GPL-2.0-or-later +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% block title %}{% block head_title %}{% endblock %}{% endblock title %} diff --git a/photo21/templates/account/email.html b/photo21/templates/account/email.html index 9329cab..14d705f 100644 --- a/photo21/templates/account/email.html +++ b/photo21/templates/account/email.html @@ -1,6 +1,8 @@ {% extends "account/base.html" %} {% comment %} -SPDX-License-Identifier: GPL-2.0-or-later +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n crispy_forms_tags %} {% block head_title %}{% trans "E-mail Addresses" %}{% endblock %} diff --git a/photo21/templates/account/login.html b/photo21/templates/account/login.html index 5e2af59..18d46b2 100644 --- a/photo21/templates/account/login.html +++ b/photo21/templates/account/login.html @@ -1,6 +1,8 @@ {% extends "account/base.html" %} {% comment %} -SPDX-License-Identifier: GPL-2.0-or-later +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n crispy_forms_tags account socialaccount %} {% block head_title %}{% trans "Sign In" %}{% endblock %} diff --git a/photo21/templates/account/logout.html b/photo21/templates/account/logout.html index 7db6ac3..4165689 100644 --- a/photo21/templates/account/logout.html +++ b/photo21/templates/account/logout.html @@ -1,6 +1,8 @@ {% extends "account/base.html" %} {% comment %} -SPDX-License-Identifier: GPL-2.0-or-later +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} {% block head_title %}{% trans "Sign Out" %}{% endblock %} diff --git a/photo21/templates/account/signup.html b/photo21/templates/account/signup.html index 380b639..81c95ae 100644 --- a/photo21/templates/account/signup.html +++ b/photo21/templates/account/signup.html @@ -1,6 +1,8 @@ {% extends "account/base.html" %} {% comment %} -SPDX-License-Identifier: GPL-2.0-or-later +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n crispy_forms_tags %} {% block head_title %}{% trans "Signup" %}{% endblock %} diff --git a/photo21/templates/base.html b/photo21/templates/base.html index b5062b6..85985e9 100644 --- a/photo21/templates/base.html +++ b/photo21/templates/base.html @@ -1,4 +1,6 @@ {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load static i18n %} diff --git a/photo21/templates/index.html b/photo21/templates/index.html index b7087c8..2fb0ac6 100644 --- a/photo21/templates/index.html +++ b/photo21/templates/index.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photo21/templates/socialaccount/connections.html b/photo21/templates/socialaccount/connections.html index ae81872..2da36e5 100644 --- a/photo21/templates/socialaccount/connections.html +++ b/photo21/templates/socialaccount/connections.html @@ -1,6 +1,8 @@ {% extends "socialaccount/base.html" %} {% comment %} -SPDX-License-Identifier: GPL-2.0-or-later +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} {% block head_title %}{% trans "Account Connections" %}{% endblock %} diff --git a/photo21/urls.py b/photo21/urls.py index 66d4912..6ed415e 100644 --- a/photo21/urls.py +++ b/photo21/urls.py @@ -1,18 +1,13 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + """photo21 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.contrib import admin from django.urls import include, path, re_path from django.conf import settings @@ -21,16 +16,18 @@ from django.conf.urls.static import static from .views import IndexView, MediaAccess urlpatterns = [ - path('', IndexView.as_view(), name='index'), - path('', include('photologue.urls', namespace='photologue')), - path('accounts/', include('allauth.urls')), - path('i18n/', include('django.conf.urls.i18n')), - path('admin/doc/', include('django.contrib.admindocs.urls')), - path('admin/', admin.site.urls), + path("", IndexView.as_view(), name="index"), + path("", include("photologue.urls", namespace="photologue")), + path("accounts/", include("allauth.urls")), + path("i18n/", include("django.conf.urls.i18n")), + path("admin/doc/", include("django.contrib.admindocs.urls")), + path("admin/", admin.site.urls), ] # In production media are served through NGINX with X-Accel-Redirect if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) else: - urlpatterns.append(re_path('^media/(?P.*)', MediaAccess.as_view(), name='media')) + urlpatterns.append( + re_path("^media/(?P.*)", MediaAccess.as_view(), name="media") + ) diff --git a/photo21/views.py b/photo21/views.py index 90d71d5..5d4eb1a 100644 --- a/photo21/views.py +++ b/photo21/views.py @@ -1,4 +1,5 @@ -# Copyright (C) 2021 by BDE ENS Paris-Saclay +# This file is part of photo21 +# Copyright (C) 2021-2022 Amicale des élèves de l'ENS Paris-Saclay # SPDX-License-Identifier: GPL-3.0-or-later from django.contrib.auth.mixins import LoginRequiredMixin @@ -11,8 +12,8 @@ class MediaAccess(LoginRequiredMixin, View): def get(self, request, path): response = HttpResponse() # Content-type will be detected by nginx - del response['Content-Type'] - response['X-Accel-Redirect'] = '/protected/media/' + path + del response["Content-Type"] + response["X-Accel-Redirect"] = "/protected/media/" + path return response diff --git a/photo21/wsgi.py b/photo21/wsgi.py index a914e94..718d0ec 100644 --- a/photo21/wsgi.py +++ b/photo21/wsgi.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + """ WSGI config for photo21 project. @@ -11,6 +15,6 @@ import os from django.core.wsgi import get_wsgi_application -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'photo21.settings') +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "photo21.settings") application = get_wsgi_application() diff --git a/photologue/__init__.py b/photologue/__init__.py index e69de29..6c9e378 100644 --- a/photologue/__init__.py +++ b/photologue/__init__.py @@ -0,0 +1,3 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/photologue/admin.py b/photologue/admin.py index af7e428..272b74c 100644 --- a/photologue/admin.py +++ b/photologue/admin.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + from django.contrib import admin from django.utils.translation import gettext_lazy as _ diff --git a/photologue/apps.py b/photologue/apps.py index dad807a..a446591 100644 --- a/photologue/apps.py +++ b/photologue/apps.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + from django.apps import AppConfig diff --git a/photologue/forms.py b/photologue/forms.py index ed4eab5..d21e8b1 100644 --- a/photologue/forms.py +++ b/photologue/forms.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + import datetime from crispy_forms.helper import FormHelper diff --git a/photologue/locale/de/LC_MESSAGES/django.po b/photologue/locale/de/LC_MESSAGES/django.po index 50c106d..1ff0779 100644 --- a/photologue/locale/de/LC_MESSAGES/django.po +++ b/photologue/locale/de/LC_MESSAGES/django.po @@ -1,6 +1,6 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later # # Translators: # Translators: diff --git a/photologue/locale/es/LC_MESSAGES/django.po b/photologue/locale/es/LC_MESSAGES/django.po index e8f687f..d082913 100644 --- a/photologue/locale/es/LC_MESSAGES/django.po +++ b/photologue/locale/es/LC_MESSAGES/django.po @@ -1,6 +1,6 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later # # Translators: # Translators: diff --git a/photologue/locale/fr/LC_MESSAGES/django.po b/photologue/locale/fr/LC_MESSAGES/django.po index a996627..f419400 100644 --- a/photologue/locale/fr/LC_MESSAGES/django.po +++ b/photologue/locale/fr/LC_MESSAGES/django.po @@ -1,6 +1,6 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later # # Translators: # Translators: diff --git a/photologue/management/commands/duplicate.py b/photologue/management/commands/duplicate.py index 80786e4..9f8637e 100644 --- a/photologue/management/commands/duplicate.py +++ b/photologue/management/commands/duplicate.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + import hashlib from django.core.management.base import BaseCommand, CommandError diff --git a/photologue/management/commands/rename_media.py b/photologue/management/commands/rename_media.py index 95f5926..f26d350 100644 --- a/photologue/management/commands/rename_media.py +++ b/photologue/management/commands/rename_media.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + import os from pathlib import Path diff --git a/photologue/migrations/0001_initial.py b/photologue/migrations/0001_initial.py index 2f0927c..f483780 100644 --- a/photologue/migrations/0001_initial.py +++ b/photologue/migrations/0001_initial.py @@ -1,4 +1,6 @@ -# Generated by Django 3.2.11 on 2022-01-30 10:14 +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later import django.core.validators import django.db.models.deletion diff --git a/photologue/migrations/0002_auto_20220130_1020.py b/photologue/migrations/0002_auto_20220130_1020.py index 9355753..ae9b359 100644 --- a/photologue/migrations/0002_auto_20220130_1020.py +++ b/photologue/migrations/0002_auto_20220130_1020.py @@ -1,4 +1,6 @@ -# Generated by Django 3.2.11 on 2022-01-30 10:20 +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later from django.db import migrations diff --git a/photologue/migrations/0003_remove_gallery_is_public.py b/photologue/migrations/0003_remove_gallery_is_public.py index 2554495..d201913 100644 --- a/photologue/migrations/0003_remove_gallery_is_public.py +++ b/photologue/migrations/0003_remove_gallery_is_public.py @@ -1,4 +1,6 @@ -# Generated by Django 3.2.11 on 2022-01-30 12:14 +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later from django.db import migrations diff --git a/photologue/migrations/__init__.py b/photologue/migrations/__init__.py index e69de29..6c9e378 100644 --- a/photologue/migrations/__init__.py +++ b/photologue/migrations/__init__.py @@ -0,0 +1,3 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later diff --git a/photologue/static/lightgallery/plugins/admin/lg-admin.js b/photologue/static/lightgallery/plugins/admin/lg-admin.js index 0a5bff5..f0ecf26 100644 --- a/photologue/static/lightgallery/plugins/admin/lg-admin.js +++ b/photologue/static/lightgallery/plugins/admin/lg-admin.js @@ -1,6 +1,8 @@ /* * Custom LightGallery plugin to add some buttons for administration * + * This file is part of photo21 + * Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay * SPDX-License-Identifier: GPL-3.0-or-later */ diff --git a/photologue/templates/photologue/gallery_archive.html b/photologue/templates/photologue/gallery_archive.html index 188101b..9e58de7 100644 --- a/photologue/templates/photologue/gallery_archive.html +++ b/photologue/templates/photologue/gallery_archive.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photologue/templates/photologue/gallery_archive_year.html b/photologue/templates/photologue/gallery_archive_year.html index 580731a..794fd0d 100644 --- a/photologue/templates/photologue/gallery_archive_year.html +++ b/photologue/templates/photologue/gallery_archive_year.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photologue/templates/photologue/gallery_detail.html b/photologue/templates/photologue/gallery_detail.html index c349f5e..5fa1999 100644 --- a/photologue/templates/photologue/gallery_detail.html +++ b/photologue/templates/photologue/gallery_detail.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load static i18n %} diff --git a/photologue/templates/photologue/includes/gallery_sample.html b/photologue/templates/photologue/includes/gallery_sample.html index 68f249d..883bb2a 100644 --- a/photologue/templates/photologue/includes/gallery_sample.html +++ b/photologue/templates/photologue/includes/gallery_sample.html @@ -1,3 +1,8 @@ +{% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} {% load i18n %}
diff --git a/photologue/templates/photologue/photo_confirm_delete.html b/photologue/templates/photologue/photo_confirm_delete.html index 29c88d9..dfab897 100644 --- a/photologue/templates/photologue/photo_confirm_delete.html +++ b/photologue/templates/photologue/photo_confirm_delete.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photologue/templates/photologue/photo_confirm_report.html b/photologue/templates/photologue/photo_confirm_report.html index e682b9b..a151dda 100644 --- a/photologue/templates/photologue/photo_confirm_report.html +++ b/photologue/templates/photologue/photo_confirm_report.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photologue/templates/photologue/photo_detail.html b/photologue/templates/photologue/photo_detail.html index ef1082b..a936847 100644 --- a/photologue/templates/photologue/photo_detail.html +++ b/photologue/templates/photologue/photo_detail.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n %} diff --git a/photologue/templates/photologue/tag_detail.html b/photologue/templates/photologue/tag_detail.html index 1484f2e..15c7b6c 100644 --- a/photologue/templates/photologue/tag_detail.html +++ b/photologue/templates/photologue/tag_detail.html @@ -1,4 +1,9 @@ {% extends "base.html" %} +{% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} {% load i18n %} {% block title %}{{ object.name }}{% endblock %} diff --git a/photologue/templates/photologue/upload.html b/photologue/templates/photologue/upload.html index d2e0047..6b49a68 100644 --- a/photologue/templates/photologue/upload.html +++ b/photologue/templates/photologue/upload.html @@ -1,5 +1,7 @@ {% extends "base.html" %} {% comment %} +This file is part of photo21 +Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay SPDX-License-Identifier: GPL-3.0-or-later {% endcomment %} {% load i18n crispy_forms_tags %} diff --git a/photologue/urls.py b/photologue/urls.py index eaddfa0..68f7d76 100644 --- a/photologue/urls.py +++ b/photologue/urls.py @@ -1,3 +1,7 @@ +# This file is part of photo21 +# Copyright (C) 2022 Amicale des élèves de l'ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + from django.urls import path, re_path from .views import ( diff --git a/photologue/views.py b/photologue/views.py index 826f747..9bcc837 100644 --- a/photologue/views.py +++ b/photologue/views.py @@ -1,4 +1,5 @@ -# Copyright (C) 2021 by BDE ENS Paris-Saclay +# This file is part of photo21 +# Copyright (C) 2021-2022 Amicale des élèves de l'ENS Paris-Saclay # SPDX-License-Identifier: GPL-3.0-or-later import os