[CHANGE] Use the same quotation marks for strings and not a mix of both

Just while we're at it …
This commit is contained in:
Peter Pfeufer 2025-06-01 00:05:34 +02:00
parent 329b3fecfb
commit 6477c22308
No known key found for this signature in database

View File

@ -15,68 +15,68 @@ from django.contrib import messages
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
INSTALLED_APPS = [ INSTALLED_APPS = [
'allianceauth', # needs to be on top of this list to support favicons in Django admin (see https://gitlab.com/allianceauth/allianceauth/-/issues/1301) "allianceauth", # needs to be on top of this list to support favicons in Django admin (see https://gitlab.com/allianceauth/allianceauth/-/issues/1301)
'django.contrib.admin', "django.contrib.admin",
'django.contrib.auth', "django.contrib.auth",
'django.contrib.contenttypes', "django.contrib.contenttypes",
'django.contrib.sessions', "django.contrib.sessions",
'django.contrib.messages', "django.contrib.messages",
'django.contrib.staticfiles', "django.contrib.staticfiles",
'django.contrib.humanize', "django.contrib.humanize",
'django_celery_beat', "django_celery_beat",
'solo', "solo",
'bootstrapform', "bootstrapform",
'django_bootstrap5', # https://github.com/zostera/django-bootstrap5 "django_bootstrap5", # https://github.com/zostera/django-bootstrap5
'sortedm2m', "sortedm2m",
'esi', "esi",
'allianceauth.framework', "allianceauth.framework",
'allianceauth.authentication', "allianceauth.authentication",
'allianceauth.services', "allianceauth.services",
'allianceauth.eveonline', "allianceauth.eveonline",
'allianceauth.groupmanagement', "allianceauth.groupmanagement",
'allianceauth.notifications', "allianceauth.notifications",
'allianceauth.thirdparty.navhelper', "allianceauth.thirdparty.navhelper",
'allianceauth.analytics', "allianceauth.analytics",
'allianceauth.menu', "allianceauth.menu",
'allianceauth.theme', "allianceauth.theme",
'allianceauth.theme.darkly', "allianceauth.theme.darkly",
'allianceauth.theme.flatly', "allianceauth.theme.flatly",
'allianceauth.theme.materia', "allianceauth.theme.materia",
"allianceauth.custom_css", "allianceauth.custom_css",
'allianceauth.crontab', "allianceauth.crontab",
'sri', "sri",
] ]
SRI_ALGORITHM = "sha512" SRI_ALGORITHM = "sha512"
SECRET_KEY = "wow I'm a really bad default secret key" SECRET_KEY = "wow I'm a really bad default secret key"
# Celery configuration # Celery configuration
BROKER_URL = 'redis://localhost:6379/0' BROKER_URL = "redis://localhost:6379/0"
CELERYBEAT_SCHEDULER = "allianceauth.crontab.schedulers.OffsetDatabaseScheduler" CELERYBEAT_SCHEDULER = "allianceauth.crontab.schedulers.OffsetDatabaseScheduler"
CELERYBEAT_SCHEDULE = { CELERYBEAT_SCHEDULE = {
'esi_cleanup_callbackredirect': { "esi_cleanup_callbackredirect": {
'task': 'esi.tasks.cleanup_callbackredirect', "task": "esi.tasks.cleanup_callbackredirect",
'schedule': crontab(minute='0', hour='*/4'), "schedule": crontab(minute="0", hour="*/4"),
}, },
'esi_cleanup_token': { "esi_cleanup_token": {
'task': 'esi.tasks.cleanup_token', "task": "esi.tasks.cleanup_token",
'schedule': crontab(minute='0', hour='0'), "schedule": crontab(minute="0", hour="0"),
'apply_offset': True, "apply_offset": True,
}, },
'run_model_update': { "run_model_update": {
'task': 'allianceauth.eveonline.tasks.run_model_update', "task": "allianceauth.eveonline.tasks.run_model_update",
'schedule': crontab(minute='0', hour="*/6"), "schedule": crontab(minute="0", hour="*/6"),
'apply_offset': True "apply_offset": True,
}, },
'check_all_character_ownership': { "check_all_character_ownership": {
'task': 'allianceauth.authentication.tasks.check_all_character_ownership', "task": "allianceauth.authentication.tasks.check_all_character_ownership",
'schedule': crontab(minute='0', hour='*/4'), "schedule": crontab(minute="0", hour="*/4"),
'apply_offset': True "apply_offset": True,
},
"analytics_daily_stats": {
"task": "allianceauth.analytics.tasks.analytics_daily_stats",
"schedule": crontab(minute="0", hour="2"),
}, },
'analytics_daily_stats': {
'task': 'allianceauth.analytics.tasks.analytics_daily_stats',
'schedule': crontab(minute='0', hour='2'),
}
} }
@ -85,22 +85,20 @@ PROJECT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(PROJECT_DIR) BASE_DIR = os.path.dirname(PROJECT_DIR)
MIDDLEWARE = [ MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware', "django.middleware.security.SecurityMiddleware",
'django.contrib.sessions.middleware.SessionMiddleware', "django.contrib.sessions.middleware.SessionMiddleware",
'allianceauth.authentication.middleware.UserSettingsMiddleware', "allianceauth.authentication.middleware.UserSettingsMiddleware",
'django.middleware.locale.LocaleMiddleware', "django.middleware.locale.LocaleMiddleware",
'django.middleware.common.CommonMiddleware', "django.middleware.common.CommonMiddleware",
'django.middleware.csrf.CsrfViewMiddleware', "django.middleware.csrf.CsrfViewMiddleware",
'django.contrib.auth.middleware.AuthenticationMiddleware', "django.contrib.auth.middleware.AuthenticationMiddleware",
'django.contrib.messages.middleware.MessageMiddleware', "django.contrib.messages.middleware.MessageMiddleware",
'django.middleware.clickjacking.XFrameOptionsMiddleware', "django.middleware.clickjacking.XFrameOptionsMiddleware",
] ]
ROOT_URLCONF = 'allianceauth.urls' ROOT_URLCONF = "allianceauth.urls"
LOCALE_PATHS = ( LOCALE_PATHS = (os.path.join(BASE_DIR, "locale/"),)
os.path.join(BASE_DIR, 'locale/'),
)
LANGUAGES = ( # Sorted by Language Code alphabetical order + English at top LANGUAGES = ( # Sorted by Language Code alphabetical order + English at top
("en", _("English")), ("en", _("English")),
@ -160,58 +158,58 @@ LANGUAGE_MAPPING = {
TEMPLATES = [ TEMPLATES = [
{ {
'BACKEND': 'django.template.backends.django.DjangoTemplates', "BACKEND": "django.template.backends.django.DjangoTemplates",
'DIRS': [os.path.join(PROJECT_DIR, 'templates')], "DIRS": [os.path.join(PROJECT_DIR, "templates")],
'APP_DIRS': True, "APP_DIRS": True,
'OPTIONS': { "OPTIONS": {
'context_processors': [ "context_processors": [
'django.template.context_processors.debug', "django.template.context_processors.debug",
'django.template.context_processors.request', "django.template.context_processors.request",
'django.contrib.auth.context_processors.auth', "django.contrib.auth.context_processors.auth",
'django.contrib.messages.context_processors.messages', "django.contrib.messages.context_processors.messages",
'django.template.context_processors.i18n', "django.template.context_processors.i18n",
'django.template.context_processors.media', "django.template.context_processors.media",
'django.template.context_processors.static', "django.template.context_processors.static",
'django.template.context_processors.tz', "django.template.context_processors.tz",
'allianceauth.context_processors.auth_settings', "allianceauth.context_processors.auth_settings",
], ],
}, },
}, },
] ]
WSGI_APPLICATION = 'allianceauth.wsgi.application' WSGI_APPLICATION = "allianceauth.wsgi.application"
# Password validation # Password validation
# https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/1.10/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [ 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",
}, },
] ]
AUTHENTICATION_BACKENDS = [ AUTHENTICATION_BACKENDS = [
'allianceauth.authentication.backends.StateBackend', "allianceauth.authentication.backends.StateBackend",
'django.contrib.auth.backends.ModelBackend' "django.contrib.auth.backends.ModelBackend",
] ]
# Internationalization # Internationalization
# https://docs.djangoproject.com/en/1.10/topics/i18n/ # https://docs.djangoproject.com/en/1.10/topics/i18n/
LANGUAGE_CODE = 'en-us' LANGUAGE_CODE = "en-us"
LANGUAGE_COOKIE_AGE = 1209600 LANGUAGE_COOKIE_AGE = 1209600
TIME_ZONE = 'UTC' TIME_ZONE = "UTC"
USE_I18N = True USE_I18N = True
@ -228,44 +226,42 @@ STORAGES = {
}, },
} }
STATIC_URL = '/static/' STATIC_URL = "/static/"
STATICFILES_DIRS = [ STATICFILES_DIRS = [
os.path.join(PROJECT_DIR, 'static'), os.path.join(PROJECT_DIR, "static"),
] ]
STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_ROOT = os.path.join(BASE_DIR, "static")
# Bootstrap messaging css workaround # Bootstrap messaging css workaround
MESSAGE_TAGS = { MESSAGE_TAGS = {messages.ERROR: "danger error"}
messages.ERROR: 'danger error'
}
CACHES = { CACHES = {
"default": { "default": {
"BACKEND": "django_redis.cache.RedisCache", "BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://127.0.0.1:6379/1" # change the 1 here for the DB used "LOCATION": "redis://127.0.0.1:6379/1", # change the 1 here for the DB used
} }
} }
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db" SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
DEBUG = True DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ["*"]
DATABASES = { DATABASES = {
'default': { "default": {
'ENGINE': 'django.db.backends.sqlite3', "ENGINE": "django.db.backends.sqlite3",
'NAME': str(os.path.join(BASE_DIR, 'alliance_auth.sqlite3')), "NAME": str(os.path.join(BASE_DIR, "alliance_auth.sqlite3")),
}, },
} }
SITE_NAME = 'Alliance Auth' SITE_NAME = "Alliance Auth"
DEFAULT_THEME = "allianceauth.theme.flatly.auth_hooks.FlatlyThemeHook" DEFAULT_THEME = "allianceauth.theme.flatly.auth_hooks.FlatlyThemeHook"
DEFAULT_THEME_DARK = "allianceauth.theme.darkly.auth_hooks.DarklyThemeHook" # Legacy AAv3 user.profile.night_mode=1 DEFAULT_THEME_DARK = "allianceauth.theme.darkly.auth_hooks.DarklyThemeHook" # Legacy AAv3 user.profile.night_mode=1
LOGIN_URL = 'auth_login_user' # view that handles login logic LOGIN_URL = "auth_login_user" # view that handles login logic
LOGIN_REDIRECT_URL = 'authentication:dashboard' # default destination when logging in if no redirect specified LOGIN_REDIRECT_URL = "authentication:dashboard" # default destination when logging in if no redirect specified
LOGOUT_REDIRECT_URL = 'authentication:dashboard' # destination after logging out LOGOUT_REDIRECT_URL = "authentication:dashboard" # destination after logging out
# Both of these redirects accept values as per the django redirect shortcut # Both of these redirects accept values as per the django redirect shortcut
# https://docs.djangoproject.com/en/1.11/topics/http/shortcuts/#redirect # https://docs.djangoproject.com/en/1.11/topics/http/shortcuts/#redirect
# - url names eg 'authentication:dashboard' # - url names eg 'authentication:dashboard'
@ -273,73 +269,71 @@ LOGOUT_REDIRECT_URL = 'authentication:dashboard' # destination after logging ou
# - absolute urls eg 'http://example.com/dashboard' # - absolute urls eg 'http://example.com/dashboard'
# scopes required on new tokens when logging in. Cannot be blank. # scopes required on new tokens when logging in. Cannot be blank.
LOGIN_TOKEN_SCOPES = ['publicData'] LOGIN_TOKEN_SCOPES = ["publicData"]
EMAIL_TIMEOUT = 15 EMAIL_TIMEOUT = 15
# number of days email verification links are valid for # number of days email verification links are valid for
ACCOUNT_ACTIVATION_DAYS = 1 ACCOUNT_ACTIVATION_DAYS = 1
ESI_API_URL = 'https://esi.evetech.net/' ESI_API_URL = "https://esi.evetech.net/"
LOGGING = { LOGGING = {
'version': 1, "version": 1,
'disable_existing_loggers': False, "disable_existing_loggers": False,
'formatters': { "formatters": {
'verbose': { "verbose": {
'format': "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s", "format": "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt': "%d/%b/%Y %H:%M:%S" "datefmt": "%d/%b/%Y %H:%M:%S",
}, },
'simple': { "simple": {"format": "%(levelname)s %(message)s"},
'format': '%(levelname)s %(message)s' },
"handlers": {
"log_file": {
"level": "INFO", # edit this line to change logging level to file
"class": "logging.handlers.RotatingFileHandler",
"filename": os.path.join(BASE_DIR, "log/allianceauth.log"),
"formatter": "verbose",
"maxBytes": 1024 * 1024 * 5, # edit this line to change max log file size
"backupCount": 5, # edit this line to change number of log backups
},
"extension_file": {
"level": "INFO",
"class": "logging.handlers.RotatingFileHandler",
"filename": os.path.join(BASE_DIR, "log/extensions.log"),
"formatter": "verbose",
"maxBytes": 1024 * 1024 * 5, # edit this line to change max log file size
"backupCount": 5, # edit this line to change number of log backups
},
"console": {
"level": "DEBUG", # edit this line to change logging level to console
"class": "logging.StreamHandler",
"formatter": "verbose",
},
"notifications": { # creates notifications for users with logging_notifications permission
"level": "ERROR", # edit this line to change logging level to notifications
"class": "allianceauth.notifications.handlers.NotificationHandler",
"formatter": "verbose",
}, },
}, },
'handlers': { "loggers": {
'log_file': { "allianceauth": {
'level': 'INFO', # edit this line to change logging level to file "handlers": ["log_file", "console", "notifications"],
'class': 'logging.handlers.RotatingFileHandler', "level": "DEBUG",
'filename': os.path.join(BASE_DIR, 'log/allianceauth.log'),
'formatter': 'verbose',
'maxBytes': 1024 * 1024 * 5, # edit this line to change max log file size
'backupCount': 5, # edit this line to change number of log backups
}, },
'extension_file': { "extensions": {
'level': 'INFO', "handlers": ["extension_file", "console"],
'class': 'logging.handlers.RotatingFileHandler', "level": "DEBUG",
'filename': os.path.join(BASE_DIR, 'log/extensions.log'),
'formatter': 'verbose',
'maxBytes': 1024 * 1024 * 5, # edit this line to change max log file size
'backupCount': 5, # edit this line to change number of log backups
}, },
'console': { "django": {
'level': 'DEBUG', # edit this line to change logging level to console "handlers": ["log_file", "console"],
'class': 'logging.StreamHandler', "level": "ERROR",
'formatter': 'verbose',
}, },
'notifications': { # creates notifications for users with logging_notifications permission "esi": {
'level': 'ERROR', # edit this line to change logging level to notifications "handlers": ["log_file", "console"],
'class': 'allianceauth.notifications.handlers.NotificationHandler', "level": "DEBUG",
'formatter': 'verbose',
}, },
}, },
'loggers': {
'allianceauth': {
'handlers': ['log_file', 'console', 'notifications'],
'level': 'DEBUG',
},
'extensions': {
'handlers': ['extension_file', 'console'],
'level': 'DEBUG',
},
'django': {
'handlers': ['log_file', 'console'],
'level': 'ERROR',
},
'esi': {
'handlers': ['log_file', 'console'],
'level': 'DEBUG',
},
}
} }
DEFAULT_AUTO_FIELD = "django.db.models.AutoField" DEFAULT_AUTO_FIELD = "django.db.models.AutoField"