2009-10-30 11:19:58 -07:00
|
|
|
# Django settings for archweb project.
|
2021-12-23 06:02:28 -08:00
|
|
|
import sys
|
2023-11-02 04:52:30 -07:00
|
|
|
from os import path
|
2007-11-03 00:45:10 -07:00
|
|
|
|
2017-06-07 13:05:39 -07:00
|
|
|
# Set the debug values
|
2010-10-05 09:55:30 -07:00
|
|
|
DEBUG = False
|
2011-03-10 07:34:24 -08:00
|
|
|
DEBUG_TOOLBAR = False
|
2007-11-03 00:45:10 -07:00
|
|
|
|
2024-07-22 12:30:28 -07:00
|
|
|
# Export prometheus metrics
|
|
|
|
PROMETHEUS_METRICS = False
|
|
|
|
|
2017-06-07 13:05:39 -07:00
|
|
|
# Notification admins
|
2011-01-06 08:28:06 -08:00
|
|
|
ADMINS = ()
|
2010-10-05 09:55:30 -07:00
|
|
|
|
2007-11-03 00:45:10 -07:00
|
|
|
# Set managers to admins
|
|
|
|
MANAGERS = ADMINS
|
|
|
|
|
2010-10-19 07:05:26 -07:00
|
|
|
# Package out-of-date emails for orphans
|
2010-10-18 13:00:38 -07:00
|
|
|
NOTIFICATIONS = ['arch-notifications@archlinux.org']
|
|
|
|
|
2007-11-03 00:45:10 -07:00
|
|
|
# Full path to the data directory
|
2017-05-22 05:49:06 -07:00
|
|
|
DEPLOY_PATH = path.dirname(path.realpath(__file__))
|
2007-11-03 00:45:10 -07:00
|
|
|
|
2012-03-23 17:29:40 -07:00
|
|
|
# If you set this to False, Django will not use timezone-aware datetimes.
|
|
|
|
USE_TZ = True
|
|
|
|
|
|
|
|
# Local time zone for this installation. Choices can be found here:
|
|
|
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
|
|
|
# although not all choices may be available on all operating systems.
|
|
|
|
TIME_ZONE = 'UTC'
|
2007-11-03 00:45:10 -07:00
|
|
|
|
|
|
|
# Language code for this installation. All choices can be found here:
|
|
|
|
# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
|
|
|
|
# http://blogs.law.harvard.edu/tech/stories/storyReader$15
|
|
|
|
LANGUAGE_CODE = 'en-us'
|
2008-04-16 19:51:29 -07:00
|
|
|
DEFAULT_CHARSET = 'utf-8'
|
2007-11-03 00:45:10 -07:00
|
|
|
|
|
|
|
SITE_ID = 1
|
|
|
|
|
2010-09-14 16:47:12 -07:00
|
|
|
# Default date format in templates for 'date' filter
|
|
|
|
DATE_FORMAT = 'Y-m-d'
|
2011-07-03 16:56:05 -07:00
|
|
|
DATETIME_FORMAT = 'Y-m-d H:i'
|
2010-09-14 16:47:12 -07:00
|
|
|
|
2021-12-20 12:55:18 -08:00
|
|
|
# Disable so our own DATE_FORMAT/DATETIME_FORMAT is used.
|
|
|
|
USE_L10N = False
|
|
|
|
|
2011-01-06 08:30:46 -08:00
|
|
|
# Login URL configuration
|
2007-12-26 11:20:24 -08:00
|
|
|
LOGIN_URL = '/login/'
|
2010-05-17 11:29:27 -07:00
|
|
|
LOGIN_REDIRECT_URL = '/'
|
2007-12-26 11:20:24 -08:00
|
|
|
|
2011-01-06 08:30:46 -08:00
|
|
|
# Set django's User stuff to use our profile model
|
2012-04-20 08:21:28 -07:00
|
|
|
AUTH_PROFILE_MODULE = 'devel.UserProfile'
|
2011-01-06 08:30:46 -08:00
|
|
|
|
2018-10-20 08:55:40 -07:00
|
|
|
MIDDLEWARE = (
|
2010-09-14 15:41:46 -07:00
|
|
|
'django.middleware.common.CommonMiddleware',
|
2010-08-09 11:32:41 -07:00
|
|
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
2010-06-05 10:58:31 -07:00
|
|
|
'django.middleware.csrf.CsrfViewMiddleware',
|
2010-08-09 11:32:41 -07:00
|
|
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
2010-09-14 15:41:46 -07:00
|
|
|
'django.contrib.messages.middleware.MessageMiddleware',
|
2012-12-30 10:42:54 -08:00
|
|
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
2019-01-28 12:28:24 -08:00
|
|
|
'django.middleware.security.SecurityMiddleware',
|
2007-11-03 00:45:10 -07:00
|
|
|
'django.middleware.http.ConditionalGetMiddleware',
|
2019-01-29 07:42:54 -08:00
|
|
|
'csp.middleware.CSPMiddleware',
|
2007-11-03 00:45:10 -07:00
|
|
|
)
|
|
|
|
|
2012-08-13 07:38:47 -07:00
|
|
|
# Base of the URL hierarchy
|
2010-01-31 11:17:03 -08:00
|
|
|
ROOT_URLCONF = 'urls'
|
2007-11-03 00:45:10 -07:00
|
|
|
|
2011-12-05 21:06:10 -08:00
|
|
|
# URL to serve static files
|
|
|
|
STATIC_URL = '/static/'
|
|
|
|
|
|
|
|
# Location to collect static files
|
2017-05-22 05:49:06 -07:00
|
|
|
STATIC_ROOT = path.join(DEPLOY_PATH, 'collected_static')
|
2011-12-05 21:06:10 -08:00
|
|
|
|
|
|
|
# Look for more static files in these locations
|
|
|
|
STATICFILES_DIRS = (
|
2017-05-22 05:49:06 -07:00
|
|
|
path.join(DEPLOY_PATH, 'sitestatic'),
|
2011-12-05 21:06:10 -08:00
|
|
|
)
|
|
|
|
|
2013-01-21 13:14:44 -08:00
|
|
|
# Static files backend that allows us to use far future Expires headers
|
2013-02-08 19:03:52 -08:00
|
|
|
STATICFILES_STORAGE = 'main.storage.MinifiedStaticFilesStorage'
|
2013-01-21 13:14:44 -08:00
|
|
|
|
2011-08-16 14:30:14 -07:00
|
|
|
# Configure where messages should reside
|
2010-06-20 21:56:01 -07:00
|
|
|
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
|
2011-08-16 14:30:14 -07:00
|
|
|
|
|
|
|
# Session configuration
|
2010-08-09 11:33:09 -07:00
|
|
|
SESSION_ENGINE = 'django.contrib.sessions.backends.cached_db'
|
2011-08-16 14:30:14 -07:00
|
|
|
SESSION_COOKIE_HTTPONLY = True
|
2019-02-05 12:56:29 -08:00
|
|
|
|
|
|
|
# CRSF cookie
|
|
|
|
CSRF_COOKIE_SECURE = True
|
|
|
|
CSRF_COOKIE_HTTPONLY = True
|
2010-08-09 11:33:09 -07:00
|
|
|
|
2012-12-30 10:42:54 -08:00
|
|
|
# Clickjacking protection
|
|
|
|
X_FRAME_OPTIONS = 'DENY'
|
|
|
|
|
2020-04-09 11:48:50 -07:00
|
|
|
# Referrer Policy
|
2021-04-12 12:59:46 -07:00
|
|
|
SECURE_REFERRER_POLICY = 'strict-origin'
|
2020-04-09 11:48:50 -07:00
|
|
|
|
2019-01-28 12:28:24 -08:00
|
|
|
# X-Content-Type-Options, stops browsers from trying to MIME-sniff the content type
|
|
|
|
SECURE_CONTENT_TYPE_NOSNIFF = True
|
|
|
|
|
|
|
|
# X-XSS-Protection, enables cross-site scripting filter in most browsers
|
|
|
|
SECURE_BROWSER_XSS_FILTER = True
|
|
|
|
|
2019-01-29 07:42:54 -08:00
|
|
|
# CSP Settings
|
|
|
|
CSP_DEFAULT_SRC = ("'self'",)
|
|
|
|
CSP_SCRIPT_SRC = ("'self'",)
|
|
|
|
CSP_INCLUDE_NONCE_IN = ['script-src']
|
|
|
|
CSP_IMG_SRC = ("'self'", 'data:',)
|
2019-02-24 08:14:17 -08:00
|
|
|
CSP_BASE_URI = ("'none'",)
|
2019-03-17 09:52:26 -07:00
|
|
|
CSP_FORM_ACTION = ("'self'",)
|
2019-02-24 08:14:17 -08:00
|
|
|
CSP_FRAME_ANCESTORS = ("'none'",)
|
2019-01-29 07:42:54 -08:00
|
|
|
|
2014-06-28 10:27:15 -07:00
|
|
|
# Use new test runner
|
|
|
|
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
|
|
|
|
|
2007-11-03 00:45:10 -07:00
|
|
|
INSTALLED_APPS = (
|
|
|
|
'django.contrib.contenttypes',
|
2018-04-23 19:51:43 -07:00
|
|
|
'django.contrib.auth',
|
2020-12-30 13:56:19 -08:00
|
|
|
'django.contrib.humanize',
|
2010-06-20 21:56:01 -07:00
|
|
|
'django.contrib.messages',
|
2007-11-03 00:45:10 -07:00
|
|
|
'django.contrib.sessions',
|
|
|
|
'django.contrib.sites',
|
2009-10-30 14:36:42 -07:00
|
|
|
'django.contrib.sitemaps',
|
2007-11-03 00:45:10 -07:00
|
|
|
'django.contrib.admin',
|
2011-12-05 21:06:10 -08:00
|
|
|
'django.contrib.staticfiles',
|
2012-04-24 22:09:46 -07:00
|
|
|
'django_countries',
|
2019-09-19 10:58:15 -07:00
|
|
|
'django_extensions',
|
2011-12-05 21:06:10 -08:00
|
|
|
|
|
|
|
'main',
|
2010-01-31 11:17:03 -08:00
|
|
|
'mirrors',
|
|
|
|
'news',
|
|
|
|
'packages',
|
2019-10-08 06:52:38 -07:00
|
|
|
'planet',
|
2010-01-31 11:17:03 -08:00
|
|
|
'todolists',
|
|
|
|
'devel',
|
|
|
|
'public',
|
2011-04-28 15:58:13 -07:00
|
|
|
'releng',
|
2011-10-05 13:45:44 -07:00
|
|
|
'visualize',
|
2007-11-03 00:45:10 -07:00
|
|
|
)
|
|
|
|
|
2012-08-13 07:38:47 -07:00
|
|
|
# Logging configuration for not getting overspammed
|
|
|
|
LOGGING = {
|
|
|
|
'version': 1,
|
|
|
|
'filters': {
|
|
|
|
'ratelimit': {
|
|
|
|
'()': 'main.log.RateLimitFilter',
|
|
|
|
}
|
|
|
|
},
|
2021-12-23 06:02:28 -08:00
|
|
|
'formatters': {
|
|
|
|
'command': {
|
|
|
|
'format': '%(asctime)s -> %(levelname)s: %(message)s',
|
|
|
|
'datefmt': '%Y-%m-%d %H:%M:%S',
|
|
|
|
},
|
|
|
|
},
|
2012-08-13 07:38:47 -07:00
|
|
|
'handlers': {
|
|
|
|
'mail_admins': {
|
|
|
|
'level': 'ERROR',
|
|
|
|
'filters': ['ratelimit'],
|
|
|
|
'class': 'django.utils.log.AdminEmailHandler',
|
2021-12-23 06:02:28 -08:00
|
|
|
},
|
|
|
|
'command': {
|
|
|
|
'class': 'logging.StreamHandler',
|
|
|
|
'formatter': 'command',
|
|
|
|
'stream': sys.stderr,
|
|
|
|
},
|
2012-08-13 07:38:47 -07:00
|
|
|
},
|
|
|
|
'loggers': {
|
|
|
|
'django.request': {
|
|
|
|
'handlers': ['mail_admins'],
|
|
|
|
'level': 'ERROR',
|
|
|
|
'propagate': True,
|
2021-12-23 06:02:28 -08:00
|
|
|
},
|
|
|
|
'command': {
|
|
|
|
'handlers': ['command'],
|
|
|
|
'level': 'INFO',
|
|
|
|
},
|
2012-08-13 07:38:47 -07:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2017-06-07 13:05:39 -07:00
|
|
|
# Server used for linking to PGP keysearch results
|
2021-09-12 04:45:32 -07:00
|
|
|
PGP_SERVER = 'keyserver.ubuntu.com'
|
2015-12-30 17:25:41 -08:00
|
|
|
PGP_SERVER_SECURE = True
|
2011-06-02 14:21:08 -07:00
|
|
|
|
2011-11-15 12:37:46 -08:00
|
|
|
# URL for SVN access for fetching commit messages (note absence of packages or
|
|
|
|
# community bit on the end, repo.svn_root is appended)
|
2012-03-23 19:29:12 -07:00
|
|
|
SVN_BASE_URL = 'svn://svn.archlinux.org/'
|
2011-11-15 12:37:46 -08:00
|
|
|
|
2023-05-19 12:50:06 -07:00
|
|
|
GITLAB_PACKAGES_REPO = 'https://gitlab.archlinux.org/archlinux/packaging/packages'
|
|
|
|
GITLAB_PACKAGE_REPO = 'archlinux/packaging/packages'
|
2023-02-18 07:31:50 -08:00
|
|
|
GITLAB_INSTANCE = 'gitlab.archlinux.org'
|
2023-02-15 11:57:09 -08:00
|
|
|
|
2018-07-22 09:39:00 -07:00
|
|
|
# How long to keep mirrorlog's in days
|
|
|
|
MIRRORLOG_RETENTION_PERIOD = 365
|
|
|
|
|
2020-08-03 12:37:00 -07:00
|
|
|
# Display a warning if serving netboot images on downgraded ciphers
|
|
|
|
NETBOOT_SECURITY_BANNER = False
|
|
|
|
|
2015-04-02 06:11:14 -07:00
|
|
|
# Shorten some names just a bit
|
|
|
|
COUNTRIES_OVERRIDE = {
|
|
|
|
'GB': 'United Kingdom',
|
|
|
|
'US': 'United States',
|
|
|
|
}
|
|
|
|
|
2017-05-01 12:45:07 -07:00
|
|
|
# Make this unique, and don't share it with anybody.
|
|
|
|
SECRET_KEY = '00000000000000000000000000000000000000000000000'
|
|
|
|
|
2019-10-25 10:06:52 -07:00
|
|
|
# Mailman poster password for announcements
|
|
|
|
MAILMAN_PASSWORD = ''
|
|
|
|
|
2020-12-31 08:37:49 -08:00
|
|
|
# Announcements email address
|
2021-06-23 06:11:34 -07:00
|
|
|
ANNOUNCE_EMAIL = 'arch-announce@lists.archlinux.org'
|
2020-12-31 08:37:49 -08:00
|
|
|
|
2017-05-01 12:45:07 -07:00
|
|
|
DATABASES = {
|
|
|
|
'default': {
|
2017-06-07 13:05:39 -07:00
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
'NAME': 'database.db',
|
2017-05-01 12:45:07 -07:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
2021-07-06 18:16:25 -07:00
|
|
|
# Default implementation to use for AutoField
|
|
|
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
|
|
|
|
2019-10-08 06:52:38 -07:00
|
|
|
# Planet limit of items per feed to keep the feed size in check.
|
|
|
|
RSS_FEED_LIMIT = 25
|
|
|
|
|
2020-05-30 08:14:46 -07:00
|
|
|
# Rebuilderd API endpoint
|
|
|
|
REBUILDERD_URL = 'https://reproducible.archlinux.org/api/v0/pkgs/list'
|
|
|
|
|
2021-05-23 17:15:47 -07:00
|
|
|
# Protected TIER0 Mirror
|
|
|
|
TIER0_MIRROR_DOMAIN = 'repos.archlinux.org'
|
|
|
|
# TIER0_MIRROR_SECRET = ''
|
|
|
|
|
2022-11-09 11:34:41 -08:00
|
|
|
# Mastodon link to profile
|
|
|
|
MASTODON_LINK = ''
|
|
|
|
|
2017-06-07 13:05:39 -07:00
|
|
|
# Import local settings
|
2017-05-01 12:45:07 -07:00
|
|
|
try:
|
2021-12-20 12:55:18 -08:00
|
|
|
from local_settings import * # noqa
|
2017-05-01 12:45:07 -07:00
|
|
|
except ImportError:
|
|
|
|
pass
|
2010-10-05 09:55:30 -07:00
|
|
|
|
2017-05-22 05:55:02 -07:00
|
|
|
TEMPLATES = [
|
2017-06-07 13:05:39 -07:00
|
|
|
{
|
|
|
|
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
|
|
|
'DIRS': [
|
|
|
|
path.join(DEPLOY_PATH, 'templates')
|
|
|
|
],
|
|
|
|
'APP_DIRS': True,
|
|
|
|
'OPTIONS': {
|
|
|
|
'debug': DEBUG,
|
|
|
|
'context_processors': [
|
|
|
|
'django.contrib.auth.context_processors.auth',
|
2020-08-06 12:43:39 -07:00
|
|
|
'django.template.context_processors.request',
|
2018-01-01 12:31:13 -08:00
|
|
|
'django.template.context_processors.debug',
|
2017-06-07 13:05:39 -07:00
|
|
|
'django.contrib.messages.context_processors.messages',
|
2019-01-29 07:42:54 -08:00
|
|
|
'csp.context_processors.nonce',
|
2022-11-09 11:34:41 -08:00
|
|
|
'main.context_processors.mastodon_link',
|
2017-05-22 05:55:02 -07:00
|
|
|
],
|
|
|
|
}
|
2017-06-07 13:05:39 -07:00
|
|
|
}
|
2017-05-22 05:55:02 -07:00
|
|
|
]
|
|
|
|
|
2011-03-10 07:34:24 -08:00
|
|
|
# Enable the debug toolbar if requested
|
|
|
|
if DEBUG_TOOLBAR:
|
2024-05-31 12:23:02 -07:00
|
|
|
MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware', *list(MIDDLEWARE)]
|
2011-03-10 07:34:24 -08:00
|
|
|
|
2024-05-31 12:23:02 -07:00
|
|
|
INSTALLED_APPS = [*list(INSTALLED_APPS), 'debug_toolbar']
|
2011-03-10 07:34:24 -08:00
|
|
|
|
2024-07-22 12:30:28 -07:00
|
|
|
if PROMETHEUS_METRICS:
|
|
|
|
MIDDLEWARE = ['django_prometheus.middleware.PrometheusBeforeMiddleware', *list(MIDDLEWARE), 'django_prometheus.middleware.PrometheusAfterMiddleware']
|
|
|
|
|
|
|
|
INSTALLED_APPS = [*list(INSTALLED_APPS), 'django_prometheus']
|
|
|
|
|
2007-12-29 16:42:55 -08:00
|
|
|
# vim: set ts=4 sw=4 et:
|